hi
how can i use javascript to create a countdown timer
i'm creating online exam and i want a timer that counts for an hour then do some php fucntions
thanks
hi
how can i use javascript to create a countdown timer
i'm creating online exam and i want a timer that counts for an hour then do some php fucntions
thanks
and run timer() on body loadCode:<script type="text/javascript"> var t; var v=new Array(1, 0, 0, 0, 0); function timer() { v[2]--; for (i=2; i>0;i--) { if (v[i]<0) { v[i]=59; v[i-1]--; } } if (v[0]==0&&v[1]==0&&v[2]==0) { //timer is over } else { t=setTimeout("timer()", 1000); v[3]=v[1]<10?"0"+v[1]:v[1]; v[4]=v[2]<10?"0"+v[2]:v[2]; document.getElementById("time").innerHTML=v[0]+':'+v[3]+':'+v[4]; } } </script> <div id="time"></div>
Last edited by Master_script_maker; 10-13-2008 at 05:02 PM.
[Jasme Library (Javascript Motion Effects)] My Site
/\/\@§†ê® §©®¡þ† /\/\@|{ê®
There are 10 kinds of people in the world, those that understand binary and those that don't.
thank very much
last question
is it possible to keep the state of the current time value
becouse the online exam will be seperated in more than 1 page so i want to keep the time while moving from page to page ( i want to keep it's value for example i'm at page two at time 00:40 and now i will go to page 2 so the time should continue from 00:40 until i reach 00:00 where i will execute my event )
thanks again
Bookmarks