游戏技术文章

登录验证的js;JS验证邮箱 验证密码

时间:2016-11-30 12:16:30  作者:棋牌资源网  来源:棋牌资源网  查看:7826  评论:0
内容摘要: var auth_email = 0, auth_pwd = 0, auth_captcha = 0, url_ajax = "/protected/user_ajax.php";function checkMail() { var A = ...
 
var auth_email = 0, auth_pwd = 0, auth_captcha = 0, url_ajax = "/protected/user_ajax.php";
function checkMail() {
    var A = /^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/,
    _ = $("#input-email").val().toLocaleLowerCase();
    if (!A.test(_)) {
        if ($(".form-group-email").find("small").text() == "")
            $(".form-group-email").find("small").text("\u90ae\u7bb1\u683c\u5f0f\u4e0d\u6b63\u786e");
        return false
    } else
        $.ajax({
            url : url_ajax,
            cache : false,
            type : "post",
            async : false,
            data : {
                email : _,
                operate : "isexist_email"
            },
            success : function (_) {
                if (_ == "avaliable") {
                    $(".form-reg .form-group-email").find("small").text("");
                    auth_email = 1
                } else if (_ == "isexist") {
                    $(".form-group-email").find("small").text("\u6b64\u90ae\u7bb1\u5df2\u88ab\u6ce8\u518c ");
                    auth_email = 0
                }
            },
            error : function () {
                alert("\u53d1\u751f\u5f02\u5e38")
            }
        })
}
function checkMail2() {
    var A = /^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/,
    _ = $("#input-email").val().toLocaleLowerCase();
    $(".form-reg div").eq(0).find("span").remove();
    if (!A.test(_)) {
        if ($(".form-group-email").find("small").text() == "") {
            $(".form-group-email").find("small").text("\u90ae\u7bb1\u683c\u5f0f\u4e0d\u6b63\u786e");
            auth_email = 0
        }
    } else {
        auth_email = 1;
        $(".form-reg .form-group-email").find("small").text("")
    }
}
function checkPwd() {
    var A = /^(?![a-z]+$)(?!\d+$)[a-z0-9_]{8,16}$/i,
    _ = $("#input-pwd").val();
    if (_.length < 8) {
        if ($(".form-group-pwd").find("small").text() == "") {
            $(".form-group-pwd").find("small").text("\u5bc6\u7801\u957f\u5ea6\u4e0d\u8db38\u4f4d");
            auth_pwd = 0
        }
        return false
    }
    if (!A.test(_)) {
        $(".form-group-pwd").find("small").text("\u5bc6\u7801\u4ec5\u5305\u542b\u5b57\u6bcd\u4e0e\u6570\u5b57");
        auth_pwd = 0;
        return false
    }
    $(".form-reg .form-group-pwd").find("small").text("");
    auth_pwd = 1
}
function checkPwd2() {
    var A = /^(?![a-z]+$)(?!\d+$)[a-z0-9_]{8,16}$/i,
    _ = $("#input-pwd").val();
    if (_.length < 8) {
        if ($(".form-group-pwd").find("small").text() == "") {
            $(".form-group-pwd").find("small").text("\u5bc6\u7801\u957f\u5ea6\u4e0d\u8db38\u4f4d");
            auth_pwd = 0
        }
        return false
    }
    if (!A.test(_)) {
        $(".form-group-pwd").find("small").text("\u5bc6\u7801\u4ec5\u5305\u542b\u5b57\u6bcd\u4e0e\u6570\u5b57");
        auth_pwd = 0;
        return false
    }
    $(".form-reg .form-group-pwd").find("small").text("");
    auth_pwd = 1
}
function checkCaptcha() {
    var _ = $("#input-captcha").val().toLocaleLowerCase();
    $.ajax({
        url : url_ajax,
        type : "post",
        async : false,
        data : {
            captcha : _,
            operate : "check_captcha"
        },
        success : function (_) {
            if (_ == "pass") {
                $(".form-reg .captcha").find("small").text("");
                auth_captcha = 1
            } else if (_ == "nopass") {
                $(".form-reg .captcha").find("small").text("\u9a8c\u8bc1\u7801\u4e0d\u6b63\u786e");
                auth_captcha = 0
            }
        },
        error : function () {
            alert("\u53d1\u751f\u5f02\u5e38")
        }
    })
}
function changeCaptcha() {
    $(".img-captcha").click()
}
function checkSubmit() {
    $(".btn-reg").attr("disabled", true).attr("value", "\u9a8c\u8bc1\u4e2d..");
    checkCaptcha();
    checkMail();
    checkPwd();
    if (auth_email == 1 && auth_pwd == 1 && auth_captcha == 1) {
        $(".btn-reg").attr("disabled", true).attr("value", "\u6ce8\u518c\u4e2d..");
        $(".form-reg").submit()
    } else {
        $(".btn-reg").attr("disabled", false).attr("value", "\u6ce8\u518c");
        return false
    }
}
function checkSubmit2() {
    $(".btn-login").attr("disabled", true).attr("value", "\u9a8c\u8bc1\u4e2d..");
    checkMail2();
    checkPwd2();
    checkCaptcha();
    if (auth_email == 1 && auth_pwd == 1 && auth_captcha == 1) {
        $(".btn-login").attr("disabled", true).attr("value", "\u767b\u5f55\u4e2d..");
        $(".form-reg").submit()
    } else {
        $(".btn-login").attr("disabled", false).attr("value", "\u767b\u5f55");
        return false
    }
}
function checkSubmit3() {
    $(".btn-reg").attr("disabled", true).attr("value", "\u9a8c\u8bc1\u4e2d..");
    checkMail2();
    checkCaptcha();
    if (auth_email == 1 && auth_captcha == 1) {
        $(".btn-reg").attr("disabled", true).attr("value", "\u5904\u7406\u4e2d..");
        $(".form-reg").submit()
    } else {
        $(".btn-reg").attr("disabled", false).attr("value", "\u627e\u56de\u5bc6\u7801");
        return false
    }
}
function checkSubmit4() {
    $(".btn-reg").attr("disabled", true).attr("value", "\u9a8c\u8bc1\u4e2d..");
    checkPwd2();
    checkCaptcha();
    if (auth_pwd == 1 && auth_captcha == 1) {
        $(".btn-reg").attr("disabled", true).attr("value", "\u5904\u7406\u4e2d..");
        $(".form-reg").submit()
    } else {
        $(".btn-reg").attr("disabled", false).attr("value", "\u91cd\u7f6e\u5bc6\u7801");
        return false
    }
}
function checkSubmit5() {
    $(".btn-reg").attr("disabled", true).attr("value", "\u9a8c\u8bc1\u4e2d..");
    checkCaptcha();
    if (auth_captcha == 1) {
        $(".btn-reg").attr("disabled", true).attr("value", "\u5904\u7406\u4e2d..");
        $(".form-reg").submit()
    } else {
        $(".btn-reg").attr("disabled", false).attr("value", "\u5151\u6362");
        return false
    }
}
 

 

标签:登录验证的js JS验证邮箱 验证密码 

欢迎加入VIP,【VIP售价:只要288元永久VIP会员】畅享商业棋牌游戏程序下载,点击开通!

下载说明


☉本站所有源码和资源均由站长亲自测试-绝对保证都可以架设,运营!
☉如源码和资源有损坏或所有链接均不能下载,请告知管理员,

☉本站软件和源码大部分为站长独资,资源购买和收集,放心下载!

☉唯一站长QQ:1004003180  [人格担保-本站注重诚信!]

☉购买建议E-mail:1004003180@qq.com   源码收购 E-mail:1004003180@qq.com    

☉本站文件解压密码  【文章内都自带解压密码,每个密码不同!】


本站提供的所有源码,均来源站长提供,仅学习交流 浙ICP备09009969号

由此产生不良后果和法律责任与本站无关,如果侵犯了您的版权,请来信告知 1004003180@qq.com 将及时更正和删除! 

Copyright © 2008-2024 棋牌资源网,你身边的棋牌资源下载站    All Rights Reserved