<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">///&lt;reference path="jquery-1.4.4.min.js" /&gt;

$(function () {
    var telinput = '';
    if ($('#Liuyan1_txtTel').length &gt; 0) {

        telinput = '#Liuyan1_txtTel';
    } else if ($('#liuyan1_txtTel').length &gt; 0) {
        telinput = '#liuyan1_txtTel';
    }
    else if ($('#txtTel').length &gt; 0) {
        telinput = '#txtTel';
    } else if ($('#guest_tel').length &gt; 0) {
        telinput = '#guest_tel';
    } else if ($('#liuyanhandset').length &gt; 0) {
        telinput = '#liuyanhandset';
    }
    $(telinput).blur(function () {
        var cellphone = $(telinput).val();
        if (cellphone == "") {
            alert("手机号不能为空!");
        } else if (!isMobile(cellphone)) {
            alert("请输入正确的手机号!");
        } else {
            var param = {
                phone: cellphone
            };

            $.ajax({
                url: "/ashx/SMSCheck.ashx?action=CheckPhoneIsOK",
                data: param,
                dataType: "json",
                async: false,
                success: function (data) {
                    var success = data.data;
                    if (success == 0) {
                        $("tr[id$='SmsCheck']").show();
                        $("tr[id$='Numcode']").hide();
                        $("#hfcode").val("SmsCode");
                    }
                    else {
                        $("tr[id$='SmsCheck']").hide();
                        $("tr[id$='Numcode']").show();
                        $("#hfcode").val("NumCode");
                    }
                }
            });
        }
    });


    $("#GetSMSCode").click(function () {
        var cellphone = $(telinput).val();
        if (cellphone == "") {
            alert("手机号不能为空!");
        } else if (!isMobile(cellphone)) {
            alert("请输入正确的手机号!");
        } else {
            time($(this));//	时间倒计时
            var param = {
                phone: cellphone
            };
            $.ajax({
                url: '/ashx/SMSCheck.ashx?action=Send',
                data: param,
                dataType: "json",
                async: false,
                success: function (data) {
                    var success = data.data;
                }
            });
        }
    });
});

function isMobile(value) {
    return /^1[3|4|5|6|7|8|9][0-9]{9}$/.test(value);
}

var wait = 60;//时间 
function time(o) {//o为按钮的对对象
    if (wait == 0) {
        o.removeAttr("disabled");
        o.val("获取短信验证码");//改变按钮中value的值 
        wait = 60;
    } else {
        o.attr("disabled", true);//倒计时过程中禁止点击按钮 
        o.val("重新获取(" + wait + ")");//改变按钮中value的值 
        wait--;
        setTimeout(function () {
            time(o);//循环调用 
        }, 1000);
    }
}
</pre></body></html>