count down that does not reset on page refresh
I found this count down timer code here http://jsfiddle.net/QH6X8/ I would lik开发者_如何学Goe to make 3 additions if possible.
How can I make it so that the count down does not reset and start all over if the visitor reloads the page.
In the code it has
var end = new Date('15 Jul 2011');
How can I make it so that it is counting down to a specific hour instead of day(s) like thisvar end = new Date('15 Jul 2011 1:00 PM PDT');
Lastly after the count down is finished I would like it to display some text
Your time is up!
.
For the first, use cookies. A full tutorial can be found here.
For the second: var end = new Date('15 Jul 2011 1:00 PM PDT');
Well it already looks like you know how to use setInterval, so, instead of continuing to modify the timer, use document.getElementById('countdown').innerHTML =
"Your time is up"
So that takes care of 3.
精彩评论