//方法 function countDownTimerCallback(a) { var h = addZero(Math.floor(a / 3600)); m = addZero(Math.floor(a / 60) % 60), s = addZero(Math.floor(a) % 60); d = h + "时" + m + "分" + s + "秒"; document.getElementById("countdown").innerHTML = "时间还有" + d }
function addZero(n){ if(n < 10){ n = '0'+n; } return n; }; //倒计开始 var t = 60; var thisSetInterval = setInterval(function(){ if(t>=0){ countDownTimerCallback(t); t-- }else{ clearInterval(thisSetInterval); } },1000);
源码下载 点击下载
新闻热点
疑难解答