js手机验证码倒计时
super
2019-03-25 11:37

var countdown = 60; function settime(obj) { if (countdown == 0) { $(obj).attr("disabled", false); $(obj).text("获取验证码"); countdown = 60; return false; } else { $(obj).attr("disabled", true); $(obj).text("重新发送(" + countdown + ")"); countdown--; } setTimeout(function() { settime(obj); }, 1000); }
obj是按钮对象
0 条讨论