10分钟倒计时简易

var maxtime = 10*60; //
function CountDown() {
if (maxtime >= 0) {
minutes = Math.floor(maxtime / 60);
seconds = Math.floor(maxtime % 60);
if (minutes<10) minutes='0'+minutes;
if (seconds<10) seconds='0'+seconds;
// msg = "还有" + minutes + "分" + seconds + "秒";
document.all["timer"].innerHTML = minutes;
document.all["timers"].innerHTML = seconds;
// if (maxtime == 5 * 60)alert("距离结束仅剩5分钟");
--maxtime;
} else{
clearInterval(timer);
$('.gx').hide();
$('.ygx').show();
// alert("时间到,结束!");

}
}
timer = setInterval("CountDown()", 1000);

猜你喜欢

转载自www.cnblogs.com/xiaobaicai123/p/9952619.html