Jump to content

Visible Countdown


ale_jrb

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!

:)
Link to comment
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.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.