Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Count Up Timer

Status
Not open for further replies.
Jan 13, 2008
167
US
Hey guys how could I simply create an HTML page that has 3, 4 however many stopclocks. That I can click start stop and reset and what these timers do is display Days, Hours, Minutes, Seconds

Once I click start it starts going and I can leave the page or what not and when I come back it still going.

When I click restart of course it goes back to Zero.

etc.
 

Google for "stateless protocol" then think through exactly what you want to achieve. Then Google for "permanent cookies" which may give you some part of what you want. It will of course be entirely dependent on the client accepting permanent cookies, which many will not.

___________________________________________________________
If you want the best response to a question, please check out FAQ222-2244 first.
'If we're supposed to work in Hex, why have we only got A fingers?'
Drive a Steam Roller
Steam Engine Prints
 
You'll need to run this most likely with server side code.

You would most likely have to set a cookie, and read it upon returning to the site, and then calculate how much time has passed and update the clocks.

Its more complex that you think because websites are not continuous. Once you leave the site, anything that was running stops, memory is cleared, etc...

So when you re-request the page everything starts again from zero.

That is unless you could have some process in the server you can call that stays running always. But if this id to be done by more than 1 person, then you could have a serious amount of processes running for the clocks, that could potentially bog down your server.

The cookie option while not really keeping the clocks running, can calculate the time that has passed, and then adjust the clocks display to show how much time has passed since you started it.

However as i said again, this will require extensive server side coding.
So I suggest you find out what server-side language is available to you, and then ask in the appropriate forum for it.

----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
If your users login then just have a field in the user id that grabs Now() very time they start the clock then you can base the time displayed on the time diff between the db & current, reset would just clear out the db

Cheech

[Peace][Pipe]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top