var wait = 60;
function time(btns) {
var btn = document.getElementById(btns);//获取按钮对象
if (wait == 0) {
btn.removeAttribute("disabled");
btn.value = "获取验证码";
wait = 60;
} else {
btn.setAttribute("disabled", true);
btn.value = wait + "秒后重新获取验证码";
wait--;
setTimeout(function () {
time(btns);
},
1000)
}
}
function time(btns) {
var btn = document.getElementById(btns);//获取按钮对象
if (wait == 0) {
btn.removeAttribute("disabled");
btn.value = "获取验证码";
wait = 60;
} else {
btn.setAttribute("disabled", true);
btn.value = wait + "秒后重新获取验证码";
wait--;
setTimeout(function () {
time(btns);
},
1000)
}
}