zoukankan      html  css  js  c++  java
  • tipsText表单验证(注册)

    注册表单验证脚本

    <script src="/assets/skins/js/jquery-1.11.2.min.js"></script> 
    <script src="/scripts/jquery/jquery.form.min.jstype="text/javascript"></script> 
    <script src="/scripts/jquery/Validform_v5.3.2_min.jstype="text/javascript"></script> 
    <script src="/scripts/jquery/Validform_Datatype.jstype="text/javascript"></script>
    <script>
    $('#reg-form').Validform({
        tiptype: function (msg, o, cssctl) {
            if (o.obj.parents("li").find(".infotip").length == 0) {
                o.obj.parents("li").append("<div class='infotip' />");
                o.obj.parents("li").next().find(".infotip").remove();
            }
            var objtip = o.obj.parents("li").find(".infotip");
            cssctl(objtip, o.type);
            objtip.text(msg);
            //if (o.type == 3) {
            //    o.obj.focus();
            //    $("#tipsText").html(msg);
            //}
        },
        callback: function (form) {
            $(form).ajaxSubmit({
                url: "/Handle/Reg.ashx?action=reg",
                type: "post",
                dataType: "json",
                beforeSubmit: function (formData, jqForm, options) {
                    $("#tipsText").html("");
                    $('#regist_submit_btn').val('正在注册...').attr('disabled', !0);
                },
                success: function (data, textStatus) {
                    if (data.status == "failure") {
                        $("#check_code_tips").html(data.msg);
                        //$("#checkCode").attr("src", "/tools/verify_code.ashx?" + Math.random());
                        window.setTimeout(function () {
                            $('#regist_submit_btn').val('注册').attr('disabled', !1);
                        }, 1000);
                    } else if (data.status == "success") {
                        $('#regist_submit_btn').val('注册成功,页面正在跳转中...');
                        window.setTimeout(function () {
                            window.location.href = "/UserCenter";
                        }, 1000);
                    } else {
                        $('#regist_submit_btn').val('注册').attr('disabled', !1);
                        //$("#checkCode").attr("src", "/tools/verify_code.ashx?" + Math.random());
                    }
                },
                error: function (XMLHttpRequest, textStatus, errorThrown) {
                    $("#tipsText").html(textStatus + ":" + errorThrown);
                }
            });
            return false;
        }
    });
    </script>
     
  • 相关阅读:
    成功引爆
    pecompact2脱壳手记
    象棋
    今天小雨
    出错了,怎么办?
    设计模式——Adapter模式
    表设计中应注意的2点
    设计模式——Singleton模式
    设计模式——Facade模式
    设计模式——Strategy模式
  • 原文地址:https://www.cnblogs.com/jronny/p/6752475.html
Copyright © 2011-2022 走看看