首页 > 代码库 > jQuery 发送验证码倒计时按钮 复制代码

jQuery 发送验证码倒计时按钮 复制代码

<!DOCTYPE html><html><head>    <title></title>    <script src="http://www.mamicode.com/scripts/jquery.js" type="text/javascript"></script>    <script>        $(function () {            var util = {                wait: 90,                hsTime: function (that) {                    _this = $(this);                    if (_this.wait == 0) {                        $(‘#hsbtn‘).removeAttr("disabled").val(‘重发短信验证码‘);                        _this.wait = 90;                    } else {                        var _this = this;                        $(that).attr("disabled", true).val(‘在‘ + _this.wait + ‘秒后点此重发‘);                        _this.wait--;                        setTimeout(function () {                            _this.hsTime(that);                        }, 1000)                    }                }            }            util.hsTime(‘#hsbtn‘);            $("#hsbtn").click(function(){                util.hsTime(‘#hsbtn‘);            })        })    </script></head><body><input type="button" id="hsbtn" /></body></html>

 

jQuery 发送验证码倒计时按钮 复制代码