提交用户表单登陆页面,短新验证码(倒计时)

    <div class="Mar">
                    <div class="input_content_title">
                        <span style="width: 1rem; color: #FD0000;">*</span>短信验证:
                    </div>
                    <div class="input_content_shu">
                        <div>
                            <input type="text" id="Code" name="Code" placeholder="请输入短信验证码" class="input_content_code" />
                            <input id="code" name="code" class="input_content_code_txt" value="获取验证码" onclick="clickButton(this)"  readonly />
                            <div class="clear"></div>
                        </div>
                    </div>
                </div>

  <script>
        $(function () {
            $(".input_content_code_txt").click(function () {
                var str_phone = $("#Phone").val();
                var Vstr = /^[1][3|4|5|7|8][0-9]{9}$/;
                if (str_phone == "") {
                    layer.msg('手机号码,不能为空');
                    return false;
                }
                if (!(Vstr.test(str_phone))) {
                    layer.msg('无效手机号');
                    return false;
                }
                $.post("handlers/RegisterVerification.ashx", { Phone: str_phone }, function (date) {
                    if (date == "1") {
                        layer.msg('发送成功!');
                    }
                    else {
                        layer.msg(date);
                        return false;
                    }
                })
            })
        })
        function clickButton(obj) {
            var str_phone = $("#Phone").val();
            var Vstr = /^[1][3|4|5|7|8][0-9]{9}$/;
            if (str_phone == "") {
                return false;
            }
            if (!(Vstr.test(str_phone))) {
                return false;
            }
            var obj = $(obj);
            obj.attr("disabled", "disabled");/*按钮倒计时*/
            var time = 300;
            var set = setInterval(function () {
                obj.val(--time + "(s)");
            }, 1000);/*等待时间*/
            setTimeout(function () {
                obj.attr("disabled", false).val("重新获取验证码");/*倒计时*/
                clearInterval(set);
            }, 300000);
        }
    </script>

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值