js倒計時60秒獲取驗證碼
阿新 • • 發佈:2017-06-16
重新發送 驗證 func 重新 cnblogs col 驗證碼 type function
var wait=60; function settime(o) { if (wait == 0) { o.removeAttribute("disabled"); o.value="發送驗證碼"; wait = 60; } else { o.setAttribute("disabled", true); o.value="重新發送(" + wait + ")"; wait--; setTimeout(function() { settime(o) }, 1000) } }
<input id="btn" onclick="settime(this)" class="" type="button" value="發送驗證碼" />
js倒計時60秒獲取驗證碼