首先看这个现场演示 - http://jsfiddle.net/im4aLL/yjdZf/1/
使用 jQuery 进行演示 -
function countdown(){
today = new Date();
BigDay = new Date("2013-06-2");
msPerDay = 24 * 60 * 60 * 1000 ;
timeLeft = (BigDay.getTime() - today.getTime());
e_daysLeft = timeLeft / msPerDay;
daysLeft = Math.floor(e_daysLeft);
e_hrsLeft = (e_daysLeft - daysLeft)*24;
hrsLeft = Math.floor(e_hrsLeft);
minsLeft = Math.floor((e_hrsLeft - hrsLeft)*60);
$('#countdown').html("<ul><li><small>" + daysLeft + "</small><span>Days</span></li><li><small>" + hrsLeft +"</small><span>Hours</span></li><li><small>" + minsLeft + "</small><span>Minutes</span></li></ul>");
}
setInterval(countdown, 1000);
HTML:
<div id="countdown"></div>
现在,倒计时功能的变化
BigDay = new Date("2013-06-2");
至
BigDay = new Date($your_date);
我希望这能帮到您。
更新
如果您还需要第二个倒计时,请查看此-http://jsfiddle.net/im4aLL/yjdZf/2/