Wallpapers Forums Login

Javascript Countdown Timer Code And Script Tutorial Guide Javascript Timer

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

[url=http://www.webune.com/][/url]

4. that's it, if you wan to see it in action, click on the link below where it says demo:

[url=http://tuiz.com/javascript-countdown-javascript-timer-count-down-code-script-sample-tutorial-guide-p37.html]CLICK HERE TO SEE DEMO[/url]

Hope this helps
amaresh Wed May 16, 2012
how do we run the timer code in same web page while we are working with that web page(ex for writing the test)
Usman Sun Jan 22, 2012
22-545-final-preloader.gif
<h1 align="center">
<script language="JavaS
var countDownInterv
var countDownTime=c 1;
function countDown(){
countDownTime-
if (countDownTime <=0){
countDownTime=
clearTimeout(c

return
}
if (document.all) //if IE 4
document.all.c = countDownTime " ";
else if (document.getEl //else if NS6
document.getEl " "
else if (document.layer //CHANGE TEXT BELOW TO YOUR OWN
document.c_rel in <b id="countDownTe countDownTime ' </b> seconds')
document.c_rel
}
counter=setTim 1000);
}

function startit(){
if (document.all|| //CHANGE TEXT BELOW TO YOUR OWN
document.write in <b id="countDownTe countDownTime ' </b> seconds')
countDown()
}

if (document.all||
startit()

</script>
</h1>
izwan Thu Jun 09, 2011
how to disable the link? i just want the timer countdown to zero only.. how?
Asim Fri Feb 04, 2011
thanx its working...
DJ Wed Aug 11, 2010
Hey buddy,

please get me acode of timer where, it would show (Minute:seconds) format,and will pause the time whenever the browser gets closed or a particular button gets clicked,the next time when the browser gets reopened the page, the time should start from the paused value.
tum Wed Apr 08, 2009
amazing for imagine
java Sun Jan 25, 2009
25-545-javascript-newbie.jpg
you are just amazing man, ive been loooking for something like this and i was able to find it, keep up the good work
steve Sun Oct 19, 2008
yes, i was looking for a simple javascript countdown and i found it, thanks
Joao Wed Jun 25, 2008
great stuff but let's imagine if i want 2/3 timers at the same page. what to do?
emmy Thu Aug 09, 2012
hello, am new here. pls sir, can u help me with alert time script, or countdown timer for hots pot internet users. am using mikrotik os , and i need an count down timer or time left for the users account to time out.thank u sir

Related Content

Information

Share

wallpaperama | Wallpapers | Forums | Terms Of Service

copyright © 2013 wallpaperama - All Rights Reserved - Last Updated Mon May 06, 2013 (-8 GMT)
Powered by: Webune Forums V5