<script>
function daoJiShi(endDate)
{
var now=new Date().getTime()/1000; ;
var oft=Math.round((endDate-now));
var ofd=parseInt(oft/3600/24);
var ofh=parseInt((oft%(3600*24))/3600);
var ofm=parseInt((oft%3600)/60);
var ofs=oft%60;
document.getElementById(‘end_date_0_class‘).innerHTML=‘还有 ‘+ofd+‘ 天 ‘ +ofh+ ‘ 小时 ‘ +ofm+ ‘ 分钟 ‘ +ofs+ ‘ 秒‘;
if(ofs<0){document.getElementById(‘end_date_0_class‘).innerHTML=‘倒计时结束!‘;return;};
setTimeout("daoJiShi("+endDate+")",1000);
};
</script>
原文地址:http://www.cnblogs.com/liu201312/p/3714445.html