我希望不断地拥有它,从第二次开始我就把它计算在几秒钟,几分钟,几小时,几天和几年之间。
谢谢!
答案 0 :(得分:4)
Here is a Javascript CountUp Timer I wrote. 它需要一个时间戳来开始计算时间,一个ID来放置定时器,以及一个消息附加到定时器。请在帖子底部找到演示页面链接(无法在此处提供链接)。演示页面有两种类型的计数器。
答案 1 :(得分:3)
http://www.dailycoding.com/Posts/object_oriented_programming_with_javascript__timer_class.aspx
我用过它,效果很好。使用的示例计数,但我也用它来倒计时。
答案 2 :(得分:0)
<script language="JavaScript">
TargetDate = "12/31/2020 5:00 AM";
BackColor = "palegreen";
ForeColor = "navy";
CountActive = true;
CountStepper = 1;
LeadingZero = true;
DisplayFormat = "%%D%% Days, %%H%% Hours, %%M%% Minutes, %%S%% Seconds.";
FinishMessage = "It is finally here!";
</script>
<script language="JavaScript" src="http://scripts.hashemian.com/js/countdown.js"></script>