限时优惠活动
亲爱的苦力吧用户,我们为了回馈新老用户一直以来的鼎力支持,即日起(2025-02-06至2025-03-06)凡是购买苦力吧VIP/充值K币的新老用户,都直接可获得买一送一的优惠馈赠。例如:购买一个月的VIP会员可直接获得两个月的VIP会员;充值100K币可直接获得200K币,以此类推!有任何疑问可联系在线客服,感谢各位用户对苦力吧素材的信任与厚爱,我们将一如既往的给大家上新更多优质的素材源码,祝大家开工大吉、工作顺利、心想事成。

jquery多功能多字段类型表单验证

所属分类: 网页特效-表单验证    2024-11-28 11:16:18

jquery多功能多字段类型表单验证 ie兼容6
 查看演示  登录后下载 温馨提示
登录会员即可享受免费下载
 我要建站

jquery多功能多字段类型表单验证(共4个文件)

    • index.html

使用方法

  • code
  • source
  1. (function(my){
  2. my.extend({
  3. myvali:function(id){
  4. var myobj={
  5. myVali:".vali", //input标签的父盒子class,默认vali
  6. Required:".Required", //只验证不为空
  7. RequiredTps:["不能为空!!!"], //只验证不为空提示
  8. Requireds:".Requireds", //验证不为空自定义提示
  9. reqtps:".reqtps", //验证不为空自定义提示,input父盒子的class
  10. ReqlengthTps:[""], //验证不为空长度提示
  11. RequiredsTps:["不能为空"], //验证不为空默认提示
  12. myNameMinLength:3, //默认用户名最小长度
  13. myNameMaxLength:8, //默认用户名最大长度
  14. myPasswordMinLength:6, //默认密码最小长度
  15. myPasswordMaxLength:16, //默认密码最大长度
  16. isServer:false, //是否要与数据库验证,默认false为否
  17. corrCol:["rgb(78, 117, 4)"], //默认正确提示文字的颜色
  18. errCol:["red"], //默认错误提示文字的颜色
  19. PwdStrong:false, //密码强度验证,默认false不开启,true开启
  20. isStrongTps:["弱","中","强"], //密码强度提示,可自定义
  21. isServerType:"post", //用户名以什么方式提交
  22. isServerDType:"json", //用户名以什么格式提交
  23. count:60, //发送短信验证码倒计时,默认60s
  24. isPhoneCodeType:"post", //短信验证以什么方式提交(按钮)
  25. isPhoneCodeDType:"json", //短信验证以什么格式提交(按钮)
  26. phoneCodeInputType:"post", //短信验证以什么方式提交(输入框)
  27. phoneCodeInputDType:"json", //短信验证以什么格式提交(输入框)
  28. phoneIsServerType:"post", //手机号以什么方式提交
  29. phoneIsServerDType:"json", //手机号以什么格式提交
  30. phoneIsServerType1:"post", //修改手机号以什么方式提交
  31. phoneIsServerDType1:"json", //修改手机号以什么格式提交
  32. CodeIsServerType:"post", //验证码以什么方式提交
  33. CodeIsServerDType:"json", //验证码以什么格式提交
  34. myPhone:"", //手机号
  35. myPhone1:"", //修改手机号
  36. isMyCode:false, //开启与手机同时验证发送短信功能,默认false不开启
  37. myNameNuber:"数字", //验证数字提示的名字
  38. isCheckbox:"", //勾选阅读同意
  39. callback:"undefined", //ajax提交
  40. };
  41. var mclass=$.extend({},myobj,id);
  42. var myVali=$(mclass.myVali), //input标签父盒子class
  43. myform=$(mclass.myform), //表单id
  44. mybtn=$(mclass.mybtn); //提交表单按钮
  45. //创建验证表单提示元素
  46. var p=$("<p style="+"font-size:12px;display:inline;vertical-align:top;"+"></p>");
  47. //将p元素插入到表单后代为myVali
  48. myform.find(myVali).append(p);
  49. var Required=$(mclass.Required), //验证不为空
  50. RequiredTps=$(mclass.RequiredTps), //验证不为空提示
  51. Requireds=$(mclass.Requireds), //验证不为空,不同提示
  52. reqtps=$(mclass.reqtps), //验证不为空,不同提示
  53. Reqlength=$(mclass.Reqlength), //验证不为空长度
  54. ReqlengthTps=$(mclass.ReqlengthTps), //验证不为空长度自定义提示
  55. RequiredsTps=$(mclass.RequiredsTps), //验证不为空自定义提示
  56. myname1=$(mclass.myName), //用户名
  57. myname2=$(mclass.myName2), //昵称
  58. myphone=$(mclass.myPhone), //手机号
  59. myphone1=$(mclass.myPhone1), //修改手机号
  60. myCard=$(mclass.myCard), //身份证
  61. isPhoneCode=$(Number(mclass.isPhoneCode)), //开启手机短信验证
  62. phoneCodeBtn=$(mclass.phoneCodeBtn), //发送手机号短信验证码(按钮)
  63. count=$(mclass.count), //发送短信验证码倒计时,默认60s
  64. codeBtnCol1=$(mclass.codeBtnCol1), //短信验证码倒计时(按钮,通过验证前)颜色
  65. codeBtnCol2=$(mclass.codeBtnCol2), //短信验证码倒计时(按钮,通过验证后)颜色
  66. isPhoneCodeUrl=$(mclass.isPhoneCodeUrl), //发送手机验证码与数据库验证的路径
  67. isPhoneCodeType=$(mclass.isPhoneCodeType), //以什么方式提交
  68. isPhoneCodeDType=$(mclass.isPhoneCodeDType), //以什么格式提交
  69. phoneCodeInput=$(mclass.phoneCodeInput), //手机短信验证码(输入框)
  70. phoneCodeInputUrl=$(mclass.phoneCodeInputUrl), //短信验证码与数据库验证的路径
  71. phoneCodeInputType=$(mclass.phoneCodeInputType), //以什么方式提交
  72. phoneCodeInputDType=$(mclass.phoneCodeInputDType), //以什么方式提交
  73. mymailbox=$(mclass.myMailbox), //邮箱
  74. myNuber=$(mclass.myNuber), //数字
  75. myNuberlength=$(mclass.myNuberlength), //数字长度
  76. myNameNuber=$(mclass.myNameNuber), //验证数字名字
  77. chinese=$(mclass.chinese), //验证中文
  78. chinesetps=$(mclass.chinesetps), //中文验证提示
  79. mailboxIsServer=$(Number(mclass.mailboxIsServer)), //邮箱是否要与数据库验证,默认false为否
  80. mailboxIsServerUrl=$(mclass.mailboxIsServerUrl), //邮箱与数据库验证的路径
  81. mailboxIsServerType=$(mclass.mailboxIsServerType), //以什么方式提交
  82. mailboxIsServerDType=$(mclass.mailboxIsServerDType),//以什么格式提交
  83. mypassword=$(mclass.myPassword), //密码
  84. mypasswords=$(mclass.myConfirmPassword), //确认密码
  85. phoneIsServer=$(Number(mclass.phoneIsServer)), //开启手机号与数据库验证
  86. phoneIsServerUrl=$(mclass.phoneIsServerUrl), //手机号与数据库验证的路径
  87. phoneIsServerType=$(mclass.phoneIsServerType), //以什么方式提交
  88. phoneIsServerDType=$(mclass.phoneIsServerDType), //以什么格式提交
  89. phoneIsServer1=$(Number(mclass.phoneIsServer1)), //开启手机号与数据库验证
  90. phoneIsServerUrl1=$(mclass.phoneIsServerUrl1), //手机号与数据库验证的路径
  91. phoneIsServerType1=$(mclass.phoneIsServerType1), //以什么方式提交
  92. phoneIsServerDType1=$(mclass.phoneIsServerDType1), //以什么格式提交
  93. myCode=$(mclass.myCode), //验证码
  94. CodeIsServerUrl=$(mclass.CodeIsServerUrl), //验证码与数据库匹配的路径
  95. CodeIsServerType=$(mclass.CodeIsServerType), //以什么方式提交
  96. CodeIsServerDType=$(mclass.CodeIsServerDType), //以什么格式提交
  97. PwdStrong=$(Number(mclass.PwdStrong)), //验证密码强度,true开启,默认false不开启
  98. isStrongTps=$(mclass.isStrongTps), //密码强度提示,可自定义
  99. NameMinLength=$(mclass.myNameMinLength), //用户名最小长度
  100. NameMaxLength=$(mclass.myNameMaxLength), //用户名最大长度
  101. NameMinLength2=$(mclass.myNameMinLength2), //昵称最小长度
  102. NameMaxLength2=$(mclass.myNameMaxLength2), //昵称最大长度
  103. PasswordMinLength=$(mclass.myPasswordMinLength), //密码最小长度
  104. PasswordMaxLength=$(mclass.myPasswordMaxLength), //密码最大长度
  105. corrCol=$(mclass.corrCol), //设置正确提示文字的颜色
  106. errCol=$(mclass.errCol), //设置错误提示文字的颜色
  107. nameIsserver=$(Number(mclass.nameIsServer)), //用户名是否要与数据库验证,默认false为否
  108. nameIsserverUrl=$(mclass.nameIsServerUrl), //用户名与数据库验证的路径
  109. nameIsServerType=$(mclass.nameIsServerType), //以什么方式提交
  110. nameIsServerDType=$(mclass.nameIsServerDType), //以什么格式提交
  111. isCheckd=$(mclass.isCheckbox), //勾选阅读同意
  112. isMyCode=$(mclass.isMyCode), //开启与手机同时验证发送短信功能,默认false不开启
  113. codeval=myform.find(phoneCodeBtn).val(); //获取短信验证码按钮初始value值
  114. // console.log(myNameNuber.selector)
  115. if(chinesetps.length!=0){
  116. var chitps=chinesetps[0].tps||"中文", //中文提示
  117. chiminLength=chinesetps[0].minLength||0, //中文最小长度
  118. chimaxLength=chinesetps[0].maxLength||Infinity; //中文最大长度
  119. }
  120. //所有验证的方法
  121. var valiform={
  122. //短信验证按钮
  123. ismsgbtn:function(){
  124. var codeval1=myform.find(phoneCodeBtn).val();
  125. if(codeval1=="重新获取"||codeval1==codeval){
  126. myform.find(phoneCodeBtn).css("color",codeBtnCol2[0]).removeAttr("disabled");
  127. }else{
  128. myform.find(phoneCodeBtn).css("color",codeBtnCol1[0]).attr("disabled","disabled");
  129. }
  130. },
  131. //手机号验证
  132. vphone:function(){
  133. var strphone=/^1[3|4|5|7|8][0-9]{9}$/;
  134. if($(this).val()==""){
  135. $(this).siblings("p").html("请输入手机号").removeAttr("class").css({"color":errCol[0]});
  136. }else if(!strphone.test($(this).val())){
  137. $(this).siblings("p").html("请输入11位正确的手机号").removeAttr("class").css({"color":errCol[0]});
  138. if(isPhoneCode[0]==1){
  139. if(isMyCode[0]==1){
  140. if(myCode.siblings("p").hasClass("correct")&&$(this).siblings("p").hasClass("correct")){
  141. valiform.ismsgbtn.apply(myphone);
  142. }else{
  143. myform.find(phoneCodeBtn).css("color",codeBtnCol1[0]).attr("disabled","disabled");
  144. }
  145. }else{
  146. if($(this).siblings("p").hasClass("correct")){
  147. valiform.ismsgbtn.apply(myphone);
  148. }else{
  149. myform.find(phoneCodeBtn).css("color",codeBtnCol1[0]).attr("disabled","disabled");
  150. }
  151. }
  152. }
  153. }else{
  154. // 手机号是否与数据库验证
  155. if(phoneIsServer[0]==1){
  156. //开启手机发送短信功能
  157. var $this=$(this),
  158. vl=$this.val();
  159. $.ajax({
  160. url:phoneIsServerUrl[0],
  161. type:phoneIsServerType.selector,
  162. dataType:phoneIsServerDType.selector,
  163. data:{phone:vl},
  164. success:function(data){
  165. if(data==1){
  166. $this.siblings("p").html("手机号可以注册").attr({"class":"correct"}).css({"color":corrCol[0]});
  167. if(isPhoneCode[0]==1){
  168. if(isMyCode[0]==1){
  169. if(myCode.siblings("p").hasClass("correct")){
  170. valiform.ismsgbtn.apply(myphone);
  171. }
  172. }else{
  173. if($this.siblings("p").hasClass("correct")){
  174. valiform.ismsgbtn.apply(myphone);
  175. }else{
  176. myform.find(phoneCodeBtn).css("color",codeBtnCol1[0]).attr("disabled","disabled");
  177. }
  178. }
  179. }
  180. }else{
  181. $this.siblings("p").html("手机号已被注册").removeAttr("class").css({"color":errCol[0]});
  182. if(isPhoneCode[0]==1){
  183. myform.find(phoneCodeBtn).css("color",codeBtnCol1[0]).attr("disabled","disabled");
  184. }
  185. }
  186. },
  187. error:function(error){
  188. console.log(error);
  189. }
  190. });
  191. }else{
  192. $(this).siblings("p").html("√").attr({"class":"correct"}).css({"color":corrCol[0]});
  193. if(isPhoneCode[0]==1){
  194. if(isMyCode[0]==1){
  195. if(myCode.siblings("p").hasClass("correct")){
  196. valiform.ismsgbtn.apply(myphone);
  197. }
  198. }else{
  199. if($(this).siblings("p").hasClass("correct")){
  200. valiform.ismsgbtn.apply(myphone);
  201. }else{
  202. myform.find(phoneCodeBtn).css("color",codeBtnCol1[0]).attr("disabled","disabled");
  203. }
  204. }
  205. }
  206. }
  207. }
  208. },
  209. //修改手机号验证
  210. vphone1:function(){
  211. var strphone=/^1[3|4|5|7|8][0-9]{9}$/;
  212. if($(this).val()==""){
  213. $(this).siblings("p").html("请输入手机号").removeAttr("class").css({"color":errCol[0]});
  214. }else if(!strphone.test($(this).val())){
  215. $(this).siblings("p").html("请输入11位正确的手机号").removeAttr("class").css({"color":errCol[0]});
  216. if(isPhoneCode[0]==1){
  217. if(isMyCode[0]==1){
  218. if(myCode.siblings("p").hasClass("correct")&&$(this).siblings("p").hasClass("correct")){
  219. valiform.ismsgbtn.apply(myphone);
  220. }else{
  221. myform.find(phoneCodeBtn).css("color",codeBtnCol1[0]).attr("disabled","disabled");
  222. }
  223. }else{
  224. if($(this).siblings("p").hasClass("correct")){
  225. valiform.ismsgbtn.apply(myphone);
  226. }else{
  227. myf<p></p>
(function(my){
    my.extend({
        myvali:function(id){
            var myobj={
                myVali:".vali",                            //input标签的父盒子class,默认vali

                Required:".Required",                    //只验证不为空
                RequiredTps:["不能为空!!!"],                //只验证不为空提示

                Requireds:".Requireds",                    //验证不为空自定义提示
                reqtps:".reqtps",                        //验证不为空自定义提示,input父盒子的class
                ReqlengthTps:[""],                        //验证不为空长度提示
                RequiredsTps:["不能为空"],                //验证不为空默认提示

                myNameMinLength:3,                        //默认用户名最小长度    
                myNameMaxLength:8,                        //默认用户名最大长度

                myPasswordMinLength:6,                    //默认密码最小长度
                myPasswordMaxLength:16,                    //默认密码最大长度
                isServer:false,                            //是否要与数据库验证,默认false为否

                corrCol:["rgb(78, 117, 4)"],            //默认正确提示文字的颜色
                errCol:["red"],                            //默认错误提示文字的颜色

                PwdStrong:false,                        //密码强度验证,默认false不开启,true开启
                isStrongTps:["弱","中","强"],            //密码强度提示,可自定义

                isServerType:"post",                    //用户名以什么方式提交
                isServerDType:"json",                    //用户名以什么格式提交

                count:60,                                //发送短信验证码倒计时,默认60s
                isPhoneCodeType:"post",                    //短信验证以什么方式提交(按钮)
                isPhoneCodeDType:"json",                //短信验证以什么格式提交(按钮)

                phoneCodeInputType:"post",                //短信验证以什么方式提交(输入框)
                phoneCodeInputDType:"json",                //短信验证以什么格式提交(输入框)

                phoneIsServerType:"post",                //手机号以什么方式提交
                phoneIsServerDType:"json",                //手机号以什么格式提交

                phoneIsServerType1:"post",                //修改手机号以什么方式提交
                phoneIsServerDType1:"json",                //修改手机号以什么格式提交

                CodeIsServerType:"post",                //验证码以什么方式提交
                CodeIsServerDType:"json",                //验证码以什么格式提交

                myPhone:"",                                //手机号
                myPhone1:"",                            //修改手机号
                isMyCode:false,                            //开启与手机同时验证发送短信功能,默认false不开启
                myNameNuber:"数字",                        //验证数字提示的名字
                isCheckbox:"",                           //勾选阅读同意
                callback:"undefined",                    //ajax提交
            };
            var mclass=$.extend({},myobj,id);

            var myVali=$(mclass.myVali),                    //input标签父盒子class
                myform=$(mclass.myform),                    //表单id
                mybtn=$(mclass.mybtn);                        //提交表单按钮

            //创建验证表单提示元素
            var p=$("<p style="+"font-size:12px;display:inline;vertical-align:top;"+"></p>");
            //将p元素插入到表单后代为myVali
            myform.find(myVali).append(p);
            
            var Required=$(mclass.Required),                        //验证不为空
                RequiredTps=$(mclass.RequiredTps),                    //验证不为空提示
            
                Requireds=$(mclass.Requireds),                        //验证不为空,不同提示
                reqtps=$(mclass.reqtps),                            //验证不为空,不同提示
                Reqlength=$(mclass.Reqlength),                        //验证不为空长度
                ReqlengthTps=$(mclass.ReqlengthTps),                //验证不为空长度自定义提示
                RequiredsTps=$(mclass.RequiredsTps),                //验证不为空自定义提示

                myname1=$(mclass.myName),                            //用户名
                myname2=$(mclass.myName2),                            //昵称
                myphone=$(mclass.myPhone),                            //手机号
                myphone1=$(mclass.myPhone1),                        //修改手机号
                myCard=$(mclass.myCard),                            //身份证
                isPhoneCode=$(Number(mclass.isPhoneCode)),            //开启手机短信验证
                            
                phoneCodeBtn=$(mclass.phoneCodeBtn),                //发送手机号短信验证码(按钮)
                count=$(mclass.count),                                //发送短信验证码倒计时,默认60s
                codeBtnCol1=$(mclass.codeBtnCol1),                    //短信验证码倒计时(按钮,通过验证前)颜色
                codeBtnCol2=$(mclass.codeBtnCol2),                    //短信验证码倒计时(按钮,通过验证后)颜色
                isPhoneCodeUrl=$(mclass.isPhoneCodeUrl),            //发送手机验证码与数据库验证的路径
                isPhoneCodeType=$(mclass.isPhoneCodeType),            //以什么方式提交
                isPhoneCodeDType=$(mclass.isPhoneCodeDType),        //以什么格式提交

                phoneCodeInput=$(mclass.phoneCodeInput),            //手机短信验证码(输入框)
                phoneCodeInputUrl=$(mclass.phoneCodeInputUrl),        //短信验证码与数据库验证的路径
                phoneCodeInputType=$(mclass.phoneCodeInputType),    //以什么方式提交
                phoneCodeInputDType=$(mclass.phoneCodeInputDType),    //以什么方式提交

                mymailbox=$(mclass.myMailbox),                        //邮箱
                myNuber=$(mclass.myNuber),                            //数字
                myNuberlength=$(mclass.myNuberlength),                //数字长度
                myNameNuber=$(mclass.myNameNuber),                    //验证数字名字
                
                chinese=$(mclass.chinese),                            //验证中文
                chinesetps=$(mclass.chinesetps),                    //中文验证提示

                mailboxIsServer=$(Number(mclass.mailboxIsServer)),    //邮箱是否要与数据库验证,默认false为否
                mailboxIsServerUrl=$(mclass.mailboxIsServerUrl),    //邮箱与数据库验证的路径
                mailboxIsServerType=$(mclass.mailboxIsServerType),    //以什么方式提交
                mailboxIsServerDType=$(mclass.mailboxIsServerDType),//以什么格式提交

                mypassword=$(mclass.myPassword),                    //密码
                mypasswords=$(mclass.myConfirmPassword),            //确认密码

                phoneIsServer=$(Number(mclass.phoneIsServer)),        //开启手机号与数据库验证
                phoneIsServerUrl=$(mclass.phoneIsServerUrl),        //手机号与数据库验证的路径
                phoneIsServerType=$(mclass.phoneIsServerType),        //以什么方式提交
                phoneIsServerDType=$(mclass.phoneIsServerDType),    //以什么格式提交

                phoneIsServer1=$(Number(mclass.phoneIsServer1)),    //开启手机号与数据库验证
                phoneIsServerUrl1=$(mclass.phoneIsServerUrl1),        //手机号与数据库验证的路径
                phoneIsServerType1=$(mclass.phoneIsServerType1),    //以什么方式提交
                phoneIsServerDType1=$(mclass.phoneIsServerDType1),    //以什么格式提交

                myCode=$(mclass.myCode),                            //验证码
                CodeIsServerUrl=$(mclass.CodeIsServerUrl),            //验证码与数据库匹配的路径
                CodeIsServerType=$(mclass.CodeIsServerType),        //以什么方式提交
                CodeIsServerDType=$(mclass.CodeIsServerDType),        //以什么格式提交                    

                PwdStrong=$(Number(mclass.PwdStrong)),                //验证密码强度,true开启,默认false不开启
                isStrongTps=$(mclass.isStrongTps),                    //密码强度提示,可自定义

                NameMinLength=$(mclass.myNameMinLength),            //用户名最小长度
                NameMaxLength=$(mclass.myNameMaxLength),            //用户名最大长度

                NameMinLength2=$(mclass.myNameMinLength2),            //昵称最小长度
                NameMaxLength2=$(mclass.myNameMaxLength2),            //昵称最大长度

                PasswordMinLength=$(mclass.myPasswordMinLength),    //密码最小长度    
                PasswordMaxLength=$(mclass.myPasswordMaxLength),    //密码最大长度

                corrCol=$(mclass.corrCol),                            //设置正确提示文字的颜色                                            
                errCol=$(mclass.errCol),                            //设置错误提示文字的颜色        

                nameIsserver=$(Number(mclass.nameIsServer)),        //用户名是否要与数据库验证,默认false为否
                nameIsserverUrl=$(mclass.nameIsServerUrl),            //用户名与数据库验证的路径
                nameIsServerType=$(mclass.nameIsServerType),        //以什么方式提交
                nameIsServerDType=$(mclass.nameIsServerDType),        //以什么格式提交

                isCheckd=$(mclass.isCheckbox),                        //勾选阅读同意    
                
                isMyCode=$(mclass.isMyCode),                        //开启与手机同时验证发送短信功能,默认false不开启

                codeval=myform.find(phoneCodeBtn).val();            //获取短信验证码按钮初始value值
                // console.log(myNameNuber.selector)
                if(chinesetps.length!=0){
                    var chitps=chinesetps[0].tps||"中文",                        //中文提示
                        chiminLength=chinesetps[0].minLength||0,                //中文最小长度
                        chimaxLength=chinesetps[0].maxLength||Infinity;            //中文最大长度
                }

            //所有验证的方法
            var valiform={
                //短信验证按钮
                ismsgbtn:function(){
                    var codeval1=myform.find(phoneCodeBtn).val();
                    if(codeval1=="重新获取"||codeval1==codeval){
                        myform.find(phoneCodeBtn).css("color",codeBtnCol2[0]).removeAttr("disabled");
                    }else{
                        myform.find(phoneCodeBtn).css("color",codeBtnCol1[0]).attr("disabled","disabled");
                    }
                },
                //手机号验证 
                vphone:function(){
                    var strphone=/^1[3|4|5|7|8][0-9]{9}$/;
                    if($(this).val()==""){
                        $(this).siblings("p").html("请输入手机号").removeAttr("class").css({"color":errCol[0]});
                    }else if(!strphone.test($(this).val())){
                        $(this).siblings("p").html("请输入11位正确的手机号").removeAttr("class").css({"color":errCol[0]});
                        if(isPhoneCode[0]==1){
                            if(isMyCode[0]==1){
                                if(myCode.siblings("p").hasClass("correct")&&$(this).siblings("p").hasClass("correct")){
                                    valiform.ismsgbtn.apply(myphone);
                                }else{
                                    myform.find(phoneCodeBtn).css("color",codeBtnCol1[0]).attr("disabled","disabled");
                                }
                            }else{
                                if($(this).siblings("p").hasClass("correct")){
                                    valiform.ismsgbtn.apply(myphone);
                                }else{
                                    myform.find(phoneCodeBtn).css("color",codeBtnCol1[0]).attr("disabled","disabled");
                                }
                            }
                        }
                    }else{
                        // 手机号是否与数据库验证
                        if(phoneIsServer[0]==1){
                            //开启手机发送短信功能
                            var $this=$(this),
                                vl=$this.val();
                            $.ajax({
                                url:phoneIsServerUrl[0],
                                type:phoneIsServerType.selector,
                                dataType:phoneIsServerDType.selector,
                                data:{phone:vl},
                                success:function(data){
                                    if(data==1){
                                        $this.siblings("p").html("手机号可以注册").attr({"class":"correct"}).css({"color":corrCol[0]});
                                        if(isPhoneCode[0]==1){
                                            if(isMyCode[0]==1){
                                                if(myCode.siblings("p").hasClass("correct")){
                                                    valiform.ismsgbtn.apply(myphone);
                                                }
                                            }else{
                                                if($this.siblings("p").hasClass("correct")){
                                                    valiform.ismsgbtn.apply(myphone);
                                                }else{
                                                    myform.find(phoneCodeBtn).css("color",codeBtnCol1[0]).attr("disabled","disabled");
                                                }
                                            }
                                        }
                                    }else{
                                        $this.siblings("p").html("手机号已被注册").removeAttr("class").css({"color":errCol[0]});
                                        if(isPhoneCode[0]==1){
                                            myform.find(phoneCodeBtn).css("color",codeBtnCol1[0]).attr("disabled","disabled");
                                        }
                                    }
                                },
                                error:function(error){
                                    console.log(error);
                                }
                            });
                        }else{
                            $(this).siblings("p").html("√").attr({"class":"correct"}).css({"color":corrCol[0]});
                            if(isPhoneCode[0]==1){
                                if(isMyCode[0]==1){
                                    if(myCode.siblings("p").hasClass("correct")){
                                        valiform.ismsgbtn.apply(myphone);
                                    }
                                }else{
                                    if($(this).siblings("p").hasClass("correct")){
                                        valiform.ismsgbtn.apply(myphone);
                                    }else{
                                        myform.find(phoneCodeBtn).css("color",codeBtnCol1[0]).attr("disabled","disabled");
                                    }
                                }
                            }
                        }
                    }
                },
                //修改手机号验证
                vphone1:function(){
                    var strphone=/^1[3|4|5|7|8][0-9]{9}$/;
                    if($(this).val()==""){
                        $(this).siblings("p").html("请输入手机号").removeAttr("class").css({"color":errCol[0]});
                    }else if(!strphone.test($(this).val())){
                        $(this).siblings("p").html("请输入11位正确的手机号").removeAttr("class").css({"color":errCol[0]});
                        if(isPhoneCode[0]==1){
                            if(isMyCode[0]==1){
                                if(myCode.siblings("p").hasClass("correct")&&$(this).siblings("p").hasClass("correct")){
                                    valiform.ismsgbtn.apply(myphone);
                                }else{
                                    myform.find(phoneCodeBtn).css("color",codeBtnCol1[0]).attr("disabled","disabled");
                                }
                            }else{
                                if($(this).siblings("p").hasClass("correct")){
                                    valiform.ismsgbtn.apply(myphone);
                                }else{
                                    myf<p></p>
                                                
站长提示:
1. 苦力吧素材官方QQ群:950875342
2. 平台上所有素材资源,需注册登录会员方能正常下载。
3. 会员用户积极反馈网站、素材资源BUG或错误问题,每次奖励2K币
4. PHP源码类素材,如需协助安装调试,或你有二次开发需求,可联系苦力吧客服。
5. 付费素材资源,需充值后方能下载,如有任何疑问可直接联系苦力吧客服
相关资源 / 表单验证

jquery网站会员注册表单注册验证

一款对form表单字段简单判断的验证特效,初学者可以下载学习!
  表单验证
 4507  0

jquery表单数据自动保存插件

一款轻量级form表单数据保存客户端插件,填写或选择表单后,下次访问或刷新页面不丢失,可实现自动还原数据。
  表单验证
 8159  0

jquery支持自定义的表单字段验证器

Checkify是一个基于jQuery的表单验证器,可自定义设置表单字段的字符长度、是否必填、字符类型等。
  表单验证
 6378  0

jquery轻量级表单验证插件

inputfollow.js是一个超级小的表单验证器,支持必填字段、Email邮箱和and/OR/IF逻辑操作验证。
  表单验证
 6355  0

评论数(0) 回复有机会获得K币 用户协议

^_^ 还没有人评论,快来抢个沙发!
😀
  • 😀
  • 😊
  • 😂
  • 😍
  • 😑
  • 😷
  • 😵
  • 😛
  • 😣
  • 😱
  • 😋
  • 😎
  • 😵
  • 😕
  • 😶
  • 😚
  • 😜
  • 😭
发表评论