60秒倒计时js

var wait=4;
function time(o) {
if (wait == 0) {
o.removeAttribute(“disabled”);
o.innerHTML=”获取验证码”;
wait = 4;
} else { // www.jbxue.com
o.setAttribute(“disabled”, true);
o.innerHTML=”重新发送(” + wait + “)”;
wait–;
setTimeout(function() {
time(o)
},
1000)
}
}

document.getElementById(“getCaptcha”).οnclick=function(){time(this);}

你可能感兴趣的:(60秒倒计时js)