学习验证

来源:互联网 发布:求逆矩阵的方法 编辑:程序博客网 时间:2024/06/09 16:26
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <script type="text/javascript" src="jquery.1.12.4.js"></script>
    <title></title>
    <script type="text/javascript">
        $(function(){
            var auto = 1;
            var auto2 = 1;
            var auto3 = 1;
            var auto4 = 1;
            var start = false;
           $("#email").focus(function(){
                if(start==false)
                {
                    $("#elb").text("");
                }
            });
            $("#email").blur(function(){
                var email = jQuery("#email").val();
                var myreg = /^([\.a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(\.[a-zA-Z0-9_-])+/;
                if(myreg.test(email))
                {
                    $("#ee").html("<img src='bbb.gif' style='width: 20px;height:20px;'/>");
                    $("#elb").text("输入正确!");
                    start = true;
                    return auto = 0;
                }else
                if(email == ""){
                   $("#elb").text("邮箱不能为空!");
                    return auto = 1;
                }else if(!myreg.test(email)){
                    $("#ee").html("<img src='aaa.gif' style='width: 20px;height:20px;'/>");
                    $("#elb").text("请输入有效的邮箱地址!");
                    return auto = 1;
                }else if(checkEmailIsExist()){
                    $("#elb").text("该邮箱地址已经被注册!");
                    return auto = 1;
                }
                });

            $("#name").focus(function(){
                if(start==false)
                {
                    $("#nel").text("");
                }
            });
            $("#name").blur(function(){
                if($("#name").val()=="")
                {
                    $("#nel").text("用户名不能为空!");
                    return auto2 = 1;
                }else
                if($("#name").val().length<4)
                {
                    $("#nel").text("用户名太短!");
                    return auto2 = 1;
                }else
                {
                    $("#nel").text("用户名正确");
                    return auto2 = 0;
                }
            });

            $("#password").focus(function(){
                $("#pdl").text("");
            });
            $("#password").blur(function(){
                if($("#password").val()=="")
                {
                    $("#pdl").text("密码不能为空");
                    return auto3 = 1;
                }else
                if($("#password").val().length<6)
                {
                    $("#pdl").text("密码不得低于六位");
                    return auto3 = 1;
                }
                else
                {
                    $("#pdl").text("密码正确");
                    return auto3 = 0;
                }
            });
            $("#password1").focus(function(){
                $("#pd1l").text("");
            });

            $("#password1").blur(function(){
                var a = $("#password1").val();
                var b = $("#password").val();
                if($("#password1").val()=="")
                {
                    $("#pd1l").text("确认密码不能为空!");
                    return auto4 = 1;
                }
                if(a==b)
                {
                    $("#pd1l").text("一致!");
                    return auto4 = 0;
                }else
                {
                    $("#pd1l").text("两次输入的密码不同!");
                    return auto4 = 1;
                }
            });

            $("#click").click(function () {
                if(auto==0&&auto2==0&&auto3==0&&auto4==0)
                {
                    alert("注册成功!!!!");
                }else
                {
                    alert("注册失败!!!!");
                }
            });
        });
    </script>
</head>
<body>
    <table border="1px solid black">
        <tr style="width: 500px;height:70px;">
            <td style="background-color: aqua">请填写您的Email地址:</td>
            <td>
                <input id="email" type="text" style="background-color: aquamarine"/>
                <span id="ee"></span>
                <span id="elb">请填写有效的Email地址,在下一步您将用此邮箱接收验证邮件。</span>
            </td>
        </tr>
        <tr style="width: 500px;height:70px;">
            <td style="background-color: aqua">设置您在当当网的昵称:</td>
            <td>
                <input id="name" type="text" style="background-color: aquamarine"/>
                <b id="nel">您的昵称可以由小写英文字母,中文,数组组成.</b>
            </td>
        </tr>
        <tr style="width: 500px;height:70px;">
            <td style="background-color: aqua">设置密码:</td>
            <td>
                <input id="password" type="password" style="background-color: aquamarine"/>
                <b id="pdl">您的密码可以由大小写字母组成,长度为6-20个字符</b>
            </td>
        </tr>
        <tr style="width: 500px;height:70px;">
            <td style="background-color: aqua">再次输入您设置的密码:</td>
            <td>
                <input id="password1" type="password" style="background-color: aquamarine"/>
                <b id="pd1l">请再次输入密码</b>
            </td>
        </tr>
    </table>
        <button type="button" style="margin-left:350px;width: 100px;height:30px;" id="click">注册</button>
</body>
</html>
原创粉丝点击
热门问题 老师的惩罚 人脸识别 我在镇武司摸鱼那些年 重生之率土为王 我在大康的咸鱼生活 盘龙之生命进化 天生仙种 凡人之先天五行 春回大明朝 姑娘不必设防,我是瞎子 空调接电后指示灯不亮怎么办 欧普led灯坏了怎么办 led灯条芯片坏了怎么办 太阳能板只有电压没有电流怎么办 农村按空调房屋不保温怎么办 自己一个人想去足疗店不敢去怎么办 吊灯led灯坏了怎么办 办健身卡老板携款跑路了怎么办 武安丰尚健身怎么办卡 热敷后眼睛肿了怎么办 两眼视力差距大怎么办 怀孕体重长得快怎么办 怀孕初期发胖6斤怎么办 孕早期长得太快怎么办 怀孕了肚子眼脏怎么办 孕38周孩子偏小怎么办 孕初期胖的厉害怎么办 怀孕干活累着了怎么办 怀孕了上班很累怎么办 孕妇胖的太快怎么办 孕妇长得太快怎么办 眼睛一按吱吱响怎么办 孕期太胖了怎么办啊 人流后子宫复位不好怎么办 怀孕初期有盆腔积液怎么办 怀孕了有盆腔积液怎么办 多囊怀孕不想要怎么办 6个月婴儿大小眼怎么办 健身教练岁数大了以后怎么办 超变战陀玩具手柄坏了怎么办 飓风战魂三陀螺中轴坏了怎么办 怎么办晚安角和铁陀螺 白衣服染上荧光剂了怎么办 指尖陀螺不亮了怎么办 手指陀螺不转了怎么办 月经推迟私处还老是流水怎么办 苹果手机刷机后忘记id密码怎么办 锤基意外怀孕怎么办零6 职场遇到心机婊怎么办 高二会考没过怎么办 保险柜没电了打不开怎么办