Dethman Posted April 25, 2009 Share Posted April 25, 2009 Hi guys Im still learning JS and I found this countdown then redirect script I tried to edit it to count down then display an html link can you take a look at it and tell me whats wrong? <form name="redirect"> <center> <font face="Arial"><b>You will be redirected to the script in<br><br> <form> <div name="redirect2"></div> </form> seconds</b></font> </center> <script> <!-- /* Count down then redirect script By JavaScript Kit (http://javascriptkit.com) Over 400+ free scripts here! */ //change below target URL to your own var targetURL="" //change the second to start counting down from var countdownfrom=<?=$seconds;?> var currentsecond=document.redirect.redirect2.value=countdownfrom+1 function countredirect(){ if (currentsecond!=1){ currentsecond-=1 document.redirect.redirect2.value=currentsecond } else{ var countdownfrom="<a href='buildings.php'>Count Down Successfull</a>" return } setTimeout("countredirect()",1000) } countredirect() //--> </script> Thanks Alot Brian Flores CEO Nimbusgames,llc Link to comment https://forums.phpfreaks.com/topic/155662-solved-count-down-then-display-link/ Share on other sites More sharing options...
darkfreaks Posted April 26, 2009 Share Posted April 26, 2009 Fixed missing </form> tag and put in missing semi colons: <form name="redirect"> <center> <font face="Arial"><b>You will be redirected to the script in<br><br> <form> <div name="redirect2"></div> </form> seconds</b></font> </center> <script type = "text/javascript" language = "Javascript"> <!-- /* Count down then redirect script By JavaScript Kit (http://javascriptkit.com) Over 400+ free scripts here! */ //change below target URL to your own var targetURL=""; //change the second to start counting down from var countdownfrom=<?= echo $seconds;?>; var currentsecond=document.redirect.redirect2.value=countdownfrom+1 function countredirect(){ if (currentsecond!=1){ currentsecond-=1 document.redirect.redirect2.value=currentsecond } else{ var countdownfrom="<a href='buildings.php'>Count Down Successfull</a>" return } setTimeout("countredirect()",1000) } countredirect() //--> </script> </form> Link to comment https://forums.phpfreaks.com/topic/155662-solved-count-down-then-display-link/#findComment-819375 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.