Jump to content

Archived

This topic is now archived and is closed to further replies.

ale_jrb

Visible Countdown

Recommended Posts

Hi.

I need to code a timer but I am unsure how I should go about doing so.

It needs to work in such a way that a user can click a link which will start a timer. The timer will then start counting down. It must be able to change without the user having to refresh the page. Also, the user must be able to close the page or destroy their log in section and it must carry on counting. When it reaches the end it activates something.

Does anyone know how I could manage this? Thanks very much!

:)

Share this post


Link to post
Share on other sites
well if you have a timestamp column and a timelength column in a database, when the user clicks on start, it can send the current timestamp to the database, as well as the length of time you want the timer to be.

then you would have a script that gets the information from the database. then you would use ajax and javascript to continually call the script and retrieve the information and display it.

if the user closes the browser.. well the timestamp is in the database, along with the length.

if the user goes to the countdown page, it will continue to pull the original timestamp and timelength from the database and show the countdown accordingly. all the while, the script would check to see if the current time stamp is greater than the original timestamp + the timelength. if it is, then do the event.

Share this post


Link to post
Share on other sites
Ooh... OK, thanks. Now to find out how to call a script with Javascript... :)

Thanks.

Share this post


Link to post
Share on other sites

×

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.