- Forums
- Javascipt
- Javascript Countdown Timer Code And Script Tutorial Guide Javascript Timer
i wrote this topic to show you some code you can use for JavaScript to make a countdown timer, is a very simple tutorial you can create your own and it has a demonstration too This simple tutorial code is to show you how javascript can help you display [781], Last Updated: Sat May 18, 2024
bigger_travis
Mon Dec 04, 2006
10 Comments
23711 Visits
This is a simple script that will show you how a countdown timer works with javascript:
to make it work, just do this:
1. copy and paste the code below into your editor, you can use notepad.exe in windows if you don't have a website editor.
CODE:
<p>This simple tutorial code is to show you how javascript can help you display a simple timer, you can get more complicated even if you want to display dates.</p>
<h1 align="center">
<script language="JavaScript">
var countDownInterval=5;
var countDownTime=countDownInterval+1;
function countDown(){
countDownTime--;
if (countDownTime <=0){
countDownTime=countDownInterval;
clearTimeout(counter)
window.location="http://www.wallpaperama.com";
return
}
if (document.all) //if IE 4+
document.all.countDownText.innerText = countDownTime+" ";
else if (document.getElementById) //else if NS6+
document.getElementById("countDownText").innerHTML=countDownTime+" "
else if (document.layers){ //CHANGE TEXT BELOW TO YOUR OWN
document.c_reload.document.c_reload2.document.write('Launching in <b id="countDownText">'+countDownTime+' </b> seconds')
document.c_reload.document.c_reload2.document.close()
}
counter=setTimeout("countDown()", 1000);
}
function startit(){
if (document.all||document.getElementById) //CHANGE TEXT BELOW TO YOUR OWN
document.write('Launching in <b id="countDownText">'+countDownTime+' </b> seconds')
countDown()
}
if (document.all||document.getElementById)
startit()
else
window.onload=startit
setTimeout("location.href='http://www.wallpaperama.com'" , t)
</script>
</h1>
<p align="left">HELP! - If you've found this script helpful, we would appreciate a link to wallpaperama.com. Linking to wallpaperama will make script like this more available to poeple who are looking for help, just like you. Thanks </p>
<p align="center">Script Code at <a href="http://www.wallpaperama.com">Wallpaperama.com </a></p>
2. Once you have copy and paste the code above, save the file as wallpaperama-timer.html
3. After you have saved it, open it with your browser
4. that's it, if you wan to see it in action, click on the link below where it says demo:
SEE DEMO BELOW
Hope this helps
CounterDOwn Timer DEMO:
Leave me your comments before time runs out!!!
https://www.wallpaperama.com/forums/javascript-countdown-timer-code-and-script-tutorial-guide-javascript-timer-t545.html