开发者

count down that does not reset on page refresh

开发者 https://www.devze.com 2023-03-20 21:26 出处:网络
I found this count down timer code here http://jsfiddle.net/QH6X8/ I would lik开发者_如何学Goe to make 3 additions if possible.

I found this count down timer code here http://jsfiddle.net/QH6X8/ I would lik开发者_如何学Goe to make 3 additions if possible.

  1. How can I make it so that the count down does not reset and start all over if the visitor reloads the page.

  2. 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 this var end = new Date('15 Jul 2011 1:00 PM PDT');

  3. 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.

0

精彩评论

暂无评论...
验证码 换一张
取 消