大连249建站之家免费精品网站自助建设系统平台免费微
首页 >> 技术分享 >>技术干货 >> JQUERY会员注册验证代码
详细内容

JQUERY会员注册验证代码

249小编这次开源会员注册验证代码,希望对大家有所帮助!

说明:
$("#tijiao").attr("type","button");
 $("#tijiao").attr("type","submit");
通过前面两句的应用来限制提交按钮的功能。
只有满足条件按钮才具备提交功能。
 

 
$(document).ready(function(){
        //用户名判断函数
        function myusername(){
                var uname = $("#username").val();
                    if(uname==''){
                        $("#unamet").html('用户名必须填写');
                        window.L.open('tip')('用户名必须填写',3000);    //三秒后自动关闭 框架代码
                        $("#tijiao").attr("type","button");
                        return false;
                        }
                    $.get("?c=library_login&a=loginget",{uname:uname},function(data){
                                                                    $("#unamet").html(data);
                                                                    if(data=='用户名已存在'){
                                                                        $("#tijiao").attr("type","button");
                                                                        window.L.open('tip')('用户名已存在',3000);    //三秒后自动关闭 框架代码
                                                                        }else{
                                                                        //$("#tijiao").attr("type","submit");
                                                                        }
                                                                              });
            }
        //密码判断函数
        function myuserpassword(){
            var upassword = $("#upassword").val();
                    if(upassword==''){
                        $("#pwst").html('密码必须填写');
                        $("#tijiao").attr("type","button");
                        window.L.open('tip')('密码必须填写',3000);    //三秒后自动关闭 框架代码
                        }else{
                        $("#pwst").html('');
                        //$("#tijiao").attr("type","submit");
                        }
            }
        //验证码判断函数
        function mycaptcha(){
            var captcha = $("#captcha").val();
            if(captcha==''){
                $("#capt").html(' 验证码必须填写');
                $("#tijiao").attr("type","button");
                return false;
                }
                
            $.post(ROOT_URL + '/index.php?a=mycaptcha&c=library_login', {'captcha' : $('#captcha').val()}, function(data) {
                //$("#capt").html(data ? ' 验证成功' : ' 验证失败');
                if(!data){
                    $("#capt").html('验证失败');
                    $("#tijiao").attr("type","button");
                    return false;
                    }else{
                    $("#capt").html('验证成功');
                    $("#tijiao").attr("type","submit");
                    }
                 });

            }
        
        
        $("#username").blur(function(){
                    myusername(); // 调用用户名函数
                                    });
        $("#upassword").blur(function(){
                    myuserpassword(); //调用密码函数
                                    });
        $("#captcha").blur(function(){
                    mycaptcha();    //调用验证密码函数    
                                    });
        
        $("#tijiao").click(function(){
                myusername();
                myuserpassword();
                mycaptcha();
                
                
                });
        
});

我们的外号是雷锋!~~谢谢大家关注

联系我们
更多

联系电话:0411-66373325

联系地址:大连市沙河口区富民广场

公司邮箱:2058793689@qq.com

备案信息:Copyright © 2016-2025,www.my249.com,All rights reserved

辽ICP备17015910号-1

seo seo