var count = 60 * 15;
var countdown = setInterval(CountDown, 1000);
function CountDown() {
if (count >= 0) {
var minutes = Math.floor(count / 60);
var seconds = Math.floor(count % 60);
var msg = "请等待" + minutes + "分" + seconds + "秒";
alert(msg)
--count;
} else {
clearInterval(countdown);
alert("倒计时结束")
}
}
JS实现倒计时代码实例
最新推荐文章于 2024-10-11 11:50:00 发布