一个倒计时JS脚本

<script type="text/javascript">
var timedate= new Date("August 8,2008");
var times= "2008北京奥运会";
var now = new Date();
var date = timedate.getTime() - now.getTime();
var time = Math.floor(date / (1000 * 60 * 60 * 24)+1);
if (time >= 0) document.write( "距离"+times+"还有"+time +"天")
else if (time <=3)
document.write( "<font color=red>距离"+times+"还有"+time +"天</font>")
</script>

写了一个Z-Blog的倒计时插件,用的就是这个js,http://bbs.zblogcn.com/thread-23137-1-1.html

普遍见到的有个错误,已经修正了,(1000 * 60 * 60 * 24)+1

2 thoughts to “一个倒计时JS脚本”

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注