首页 > 代码库 > js倒计时发送验证码按钮

js倒计时发送验证码按钮

var wait=60;function time(o) {        if (wait == 0) {            o.removeAttribute("disabled");                        o.value="http://www.mamicode.com/免费获取验证码";            wait = 60;        } else {            o.setAttribute("disabled", true);            o.value="http://www.mamicode.com/重新发送(" + wait + ")";            wait--;            setTimeout(function() {                time(o)            },            1000)        }    }document.getElementById("btn").onclick=function(){time(this);}

  

js倒计时发送验证码按钮