<form id="form1" runat="server"> <div class="input"> <input type="button" id="btn" class="btn_mfyzm" value="免费获取验证码" /> <script type="text/javascript"> var wait = 60; document.getElementById("btn").disabled = false; function time(o) { if (wait == 0) { o.removeAttribute("disabled"); //$(o).attr("disabled", false); jquery o.value = "免费获取验证码"; wait = 60; } else { o.setAttribute("disabled", true); o.value = wait + "秒后,重新获取验证码"; wait--; setTimeout(function () { time(o) }, 1000) } } document.getElementById("btn").onclick = function () { time(this); } </script> </div> </form>
时间: 2024-10-11 21:21:48