首页 > 代码库 > 倒计时

倒计时

window.onload = function () {
var countdown = 5;
setInterval(function () {
if (countdown >= 0) {
document.getElementById(‘settime‘).innerHTML = countdown;
countdown--;
} else {
clearInterval();
window.location.href = http://www.mamicode.com/document.getElementById(‘jumpUrl‘).getAttribute(‘href‘);
}
}, 1000)
}

倒计时