$(function(){ //获取验证码 var getCode = document.getElementById('getCode'); var wait = 60; function time(btn){ if (wait===0) { btn.removeAttribute("disabled"); btn.innerHTML = "获取验证码"; wait = 60; }else{ btn.setAttribute("disabled",true); btn.innerHTML = wait + "秒后重试"; wait--; setTimeout(function(){ time(btn); },1000); } } getCode.onclick = function(){ time(this); }; })
以上是js 短信倒计时60s的方法的详细内容。更多信息请关注PHP中文网其他相关文章!