/    Sign up×
Community /Pin to ProfileBookmark

newbie need redirect browser help

I have a shopping cart, when I click the remove button, the page refreshes and removes the product….I then want it to redirect to a url after 5 seconds…so on the button in the hyperlink tag <a></a> I put in a onclick=”check();”

here is the script:

[code]<script type=”text/javascript”>
function go(){
window.location(“http://www.yahoo.com”);
}
function check(){
setTimeout(go(), 5000);
}
</script>
[/code]

when I put alert messages in the script I wrote it goes reaches each function, but doesn’t redirect the browser and doesn’t wait 5 seconds after clicking the remove button, I used yahoo just for testing purposes of course…

[B]help a newbie out…what did I do wrong, why is nothing happening?[/B]

and putting the go() in “go()” in the setTimeout causes it to never even reach the function check when I put in alert messages…

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@KorAug 29.2007 — <i>
</i>&lt;script type="text/javascript"&gt;
function goPage(){
location.href='http://www.yahoo.com';
}
function check(){
setTimeout('goPage()', 5000);
}
&lt;/script&gt;
×

Success!

Help @michaelnyden spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...