var wait = 60;
        function time(btn) {
            var txtTel = $('#txtTel').val();
            var isMobile = /^(?:13\d|15\d)\d{5}(\d{3}|\*{3})$/;
            var isPhone = /^((0\d{2,3})-)?(\d{7,8})(-(\d{3,}))?$/;

            if (!isMobile.test(txtTel) && !isPhone.test(txtTel)) {
                alert("请正确填写电话号码,例如:13415764179或0321-4816048");
                return false;
            }
            if (wait == 0) {
                btn.removeAttribute("disabled");
                btn.value = "免费获取验证码";
                wait = 60;

            } else {
                if (wait == 60) {
                    SendSmCode();
                }
                btn.setAttribute("disabled", true);
                btn.value = wait + "秒后重新获取验证码";
                wait--;
                setTimeout(function () {
                    time(btn);
                },
                1000)
            }
        }

        function SendSmCode() {

            alert("已发送");
        }

 

相关文章:

  • 2021-12-28
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-22
  • 2021-12-05
  • 2021-09-09
猜你喜欢
  • 2021-12-21
  • 2021-09-11
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案