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="发送验证码" />
时间: 2024-10-05 03:51:33