点击获取邮箱验证码带时间(js)

//获取邮箱验证码
var wait = 60;
function time(o) {
if (wait == 0) {
o.removeAttribute("disabled");
o.value = "获取验证码";
wait = 60;
} else {
o.setAttribute("disabled", true);
o.value = "还剩(" + wait + ")秒";
wait--;
setTimeout(function() {
time(o)
}, 1000)
}

}

time(this);

你可能感兴趣的:(js)