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
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>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.