Jump to content

[SOLVED] Count down then display link


Dethman

Recommended Posts

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

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>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.