JavaScript / jQuery Countdown?

You can find a working example at jsfiddle.net/gaby/QH6X8/79 var end = new Date('15 Dec 2010'); var _second = 1000; var _minute = _second * 60; var _hour = _minute * 60; var _day = _hour *24 var timer; function showRemaining() { var now = new Date(); var distance = end - now; if (distance '; countdownElement. InnerHTML += 'Hours: ' + hours+ ''; countdownElement. InnerHTML += 'Minutes: ' + minutes+ ''; countdownElement.

InnerHTML += 'Seconds: ' + seconds+ ''; } timer = setInterval(showRemaining, 1000).

You can find a working example at jsfiddle.net/gaby/QH6X8/79/ var end = new Date('15 Dec 2010'); var _second = 1000; var _minute = _second * 60; var _hour = _minute * 60; var _day = _hour *24 var timer; function showRemaining() { var now = new Date(); var distance = end - now; if (distance '; countdownElement. InnerHTML += 'Hours: ' + hours+ ''; countdownElement. InnerHTML += 'Minutes: ' + minutes+ ''; countdownElement.

InnerHTML += 'Seconds: ' + seconds+ ''; } timer = setInterval(showRemaining, 1000).

Perfect. This is exactly what I was looking for. Thank you, Gaby!

– dcolumbus Nov 10 '10 at 23:46 @dcolumbus, you are welcome. – Gaby aka G. Petrioli Nov 10 '10 at 23:47 @Gaby aka G.

Petrioli if you want to display a message after the time expires how do you do that? – sarsar Jul 16 at 2:36 @sarsar, in the showRemaining method, check if the distance is negative. If it is then it has expired... – Gaby aka G.

Petrioli Jul 16 at 10:24 @Gaby aka G. Petrioli this code is exactly what I needed :D I don't know how long a searched for something so simple and easy to use. If I could bother you with one more thing.

What would it take to add cookies so that if a user were to refresh it wouldnt start the timer all over again? – sarsar Jul 16 at 21:26.

I'd like to avoid using a plugin if I can. A bit too heavy for what I need. – dcolumbus Nov 10 '10 at 23:35 However, is there way to use this plugin in the mannor I'm asking?

Only showing "days" when there's more than an entire day left, only showing "hours" when there's less than a day left, etc? – dcolumbus Nov 10 '10 at 23:41.

Here you can generate countdown timer if you like - just press generate and copy paste the results into . Html file ricocheting.com/code/javascript/html-gen....

Notable mention: littlewebthings.com/projects/countdown/ (probable irrelevant since you mentioned that you don't want to use a plugin).

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions