<div>倒计时<span id="ant">123</span>秒</div>
window.onload = function () {
var odiv = document.getElementById("ant");
var count = 60;
odiv.innerText = count;
var timer = null;
timer = setInterval(function () {
if (count > 0) {
count = count - 1;
odiv.innerText = count;
}
else {
clearInterval(timer);
}
}, 1000);
}
百度搜到的 不是原创 简单保留一下