jQuery 發送驗證碼倒計時按鈕 復制代碼


<!DOCTYPE html>
<html>
<head>
    <title></title>
    <script src="../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>

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM