Page 1 of 1

count down timer

Posted: Wed Sep 15, 2010 6:30 am
by bhanu
Hi every one please go through count down timers...
i want to display countdown timer in my site.
I searched so many examples but i did not get what i want.

what i require is :

subject is online exams...

In my site we are conducting an online exam , for this exam i fixed a time 2 hours.
when online user starts a exam time will start to count down h:m:s format. means 1:59:59 .59 seconds.time reached to 00:00:00 .

i want to display countdown timer in top of the question paper . Time left 1:50 :09 sec like this.

It may Javascript or in php script.

let me out from this query...

Regards
bhanu

Re: count down timer

Posted: Wed Sep 15, 2010 7:54 am
by buckit
you'll want to use javascript. you can write a javascript function to update a div with the countdown. will the page reload? if so then you need to specify a time to count down to.

so basically, say I click a button that says "start". that button would trigger some PHP to set a session variable to 2hrs from that time. then supply your javascript with that session end time as well as the current time each time the page loads and have it countdown to that time based on the current time.

now dont make the mistake to use PHP date() to specify the finish time and use javascript to speficy the current time. PHP will pull the server time and javascript will pull the client time and can cause in accurate data.