114 字1 分钟
一个倒计时JS脚本
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>");}写了一个 Z-Blog 的倒计时插件,用的就是这个 js,http://bbs.zblogcn.com/thread-23137-1-1.html
普遍见到的有个错误,已经修正了,(1000 * 60 * 60 * 24)+1