标签:
<button type="button" id="sendMsg" class="sui-btn btn-success" style="height:32px;" onclick="time()">获取验证码</button>
//倒计时
var wait = 30;
function time() {
var btnObj = document.getElementById("sendMsg");
if (wait == 0) {
btnObj.removeAttribute("disabled");
btnObj.textContent = "再次获取验证码";
wait = 30;
} else {
btnObj.setAttribute("disabled", true);
btnObj.textContent = "" + wait + "秒后可重发";
wait--;
setTimeout(function() {
time();
},1000)
}
}
标签:
原文地址:http://www.cnblogs.com/duoer/p/5939752.html