Best JavaScript code snippet using cypress
formCheck.js
Source:formCheck.js
1// JavaScript Document date:2015-11-192//表åéªè¯3$(function(){4 $('#myFormInput2').find("span[class='help-block']").fadeTo(1,0);5 //ç¹å»éç½®æé®ç§»é¤è¡¨åæ ·å¼6 $("input[type='reset']").click(function (){7 $('#myFormInput2').find("span[class='help-block']").fadeTo(1,0);8 $('#myFormInput2Error').hide();9 $('.form-group').removeClass('has-error');10 $('.form-group').removeClass('has-success');11 12 });13 /*********************************input模å¼è¡¨åä¸ä¼ éªè¯********************************************/ 14 //åæ件ä¸ä¼ æ§ä»¶éæ©æ件åæ§è¡çæä½15 $(".fileupload").change(function(){16 var value = $(this).val();17 if(value){18 var width = $(this).parent("span").prevAll(".uneditable-input").css('width');19 var ziNum = parseInt(width)/16;//æ¾ç¤ºåæ°ï¼é²æ¢åå½¢20 //$(this).parent("span").prevAll(".uneditable-input").find(".fileupload-preview").text(value.substring(0,ziNum)+"...");21 $(this).parent("span").prevAll(".uneditable-input").find("i").attr("data-original-title",value);22 $(this).parent("span").prevAll(".uneditable-input").find("i").fadeTo(1,1);23 $(this).parent("span").nextAll("span").fadeTo(1,1);24 //éªè¯25 var required = $(this).attr("required");26 var fileType = $(this).attr("fileType");27 if(required){28 //éè¦éªè¯å¿
å¡«29 if(!value){30 //没æå¼31 $(this).parents(".form-group").addClass("has-error");32 $(this).parents(".input-group").nextAll(".help-block").text("请ä¸ä¼ æ件ï¼");33 $(this).parents(".input-group").nextAll(".help-block").fadeTo(1,1);34 }else if(value&&fileType){35 //éªè¯ä¸ä¼ ç±»å36 var str = value.split(".");37 var fileHz = str[str.length - 1];38 if((fileType.toLowerCase()).indexOf(fileHz.toLowerCase())<0){39 //æ件类åä¸å¹é
40 $(this).parents(".form-group").addClass("has-error");41 $(this).parents(".input-group").nextAll(".help-block").text("æ件类åä¸å¹é
ï¼è¯·ä¸ä¼ "+fileType+"çæ件类åï¼");42 $(this).parents(".input-group").nextAll(".help-block").fadeTo(1,1);43 }else{44 $(this).parents(".form-group").removeClass("has-error").addClass("has-success");45 $(this).parents(".input-group").nextAll(".help-block").fadeTo(1,0);46 }47 }else{48 $(this).parents(".form-group").removeClass("has-error").addClass("has-success");49 $(this).parents(".input-group").nextAll(".help-block").fadeTo(1,0); 50 }51 }52 }53 });54 //åæ件ä¸ä¼ æ§ä»¶å é¤æ件åæ§è¡çæä½55 $(".fileupload").parent("span").nextAll("span").click(function(){56 $(this).prevAll(".uneditable-input").find(".fileupload-preview").text("");57 $(this).prevAll(".uneditable-input").find("i").attr("data-original-title","");58 $(this).prevAll(".uneditable-input").find("i").fadeTo(1,0);59 $(this).prev("span").find("input[type='file']").val("");60 $(this).fadeTo(1,0);61 //éªè¯62 var required = $(this).prev("span").find("input[type='file']").attr("required");63 if(required){64 //éè¦éªè¯65 $(this).parents(".form-group").addClass("has-error");66 $(this).parents(".input-group").nextAll(".help-block").text("请ä¸ä¼ æ件ï¼");67 $(this).parents(".input-group").nextAll(".help-block").fadeTo(1,1);68 }69 });70 71 /*********************************å¾æ 模å¼è¡¨åä¸ä¼ éªè¯********************************************/72 //åæ件ä¸ä¼ æ§ä»¶éæ©æ件åæ§è¡çæä½73 $(".fileuploadIocs").change(function(){74 var value = $(this).val();75 if(value){76 $(this).parent("span").prevAll(".uneditable-input").find("i").attr("data-original-title",value);77 $(this).parent("span").prevAll(".uneditable-input").find("i").fadeTo(1,1);78 $(this).parent("span").nextAll("span").fadeTo(1,1);79 //éªè¯80 var required = $(this).attr("required");81 var fileType = $(this).attr("fileType");82 if(required){83 //éè¦éªè¯å¿
å¡«84 if(!value){85 //没æå¼86 $(this).parents(".form-group").addClass("has-error");87 $(this).parents(".input-group").nextAll("i").attr("data-original-title","请ä¸ä¼ æ件ï¼");88 $(this).parents(".input-group").nextAll("i").addClass("fa-warning");89 }else if(value&&fileType){90 //éªè¯ä¸ä¼ ç±»å91 var str = value.split(".");92 var fileHz = str[str.length - 1];93 if((fileType.toLowerCase()).indexOf(fileHz.toLowerCase())<0){94 //æ件类åä¸å¹é
95 $(this).parents(".form-group").addClass("has-error");96 $(this).parents(".input-group").prevAll("i").attr("data-original-title","æ件类åä¸å¹é
ï¼è¯·ä¸ä¼ "+fileType+"çæ件类åï¼");97 $(this).parents(".input-group").prevAll("i").addClass("fa-warning");98 }else{99 $(this).parents(".form-group").removeClass("has-error").addClass("has-success");100 $(this).parents(".input-group").prevAll("i").removeClass("fa-warning").addClass("fa-check");101 $(this).parents(".input-group").prevAll("i").attr("data-original-title","");102 103 }104 }else{105 $(this).parents(".form-group").removeClass("has-error").addClass("has-success");106 $(this).parents(".input-group").prevAll("i").removeClass("fa-warning").addClass("fa-check");107 $(this).parents(".input-group").prevAll("i").attr("data-original-title","");108 }109 }110 }111 });112 //åæ件ä¸ä¼ æ§ä»¶å é¤æ件åæ§è¡çæä½113 $(".fileuploadIocs").parent("span").nextAll("span").click(function(){114 $(this).prevAll(".uneditable-input").find(".fileupload-preview").text("");115 $(this).prevAll(".uneditable-input").find("i").attr("data-original-title","");116 $(this).prevAll(".uneditable-input").find("i").fadeTo(1,0);117 $(this).prev("span").find("input[type='file']").val("");118 $(this).fadeTo(1,0);119 //éªè¯120 var required = $(this).prev("span").find("input[type='file']").attr("required");121 if(required){122 //éè¦éªè¯123 $(this).parents(".form-group").addClass("has-error");124 $(this).parents(".input-group").prevAll("i").attr("data-original-title","请ä¸ä¼ æ件ï¼");125 $(this).parents(".input-group").prevAll("i").addClass("fa-warning");126 }127 });128//*****************************spanæ示表å1**************************************129 $("#myFormInput1").find(".form-control").blur(function(){130 formCheckInput(this);131 });132 $("#myFormInput1").find(".form-control").keyup(function(){133 formCheckInput(this);134 });135 $("#myFormInput1").find(".form-control").change(function(){136 formCheckInput(this);137 });138 //éªè¯åéæ¡139// $(".form-group").find(".radio-list").mouseout(function(){140// ridioCheck(this); 141// });142 //éªè¯å¤éæ¡143 $(".form-group").find(".checkbox-list").mouseout(function(){144 checkboxCheck(this); 145 });146 //æ交表åæ¶éªè¯147 $("#myFormInput1").submit(function(){148 $("#myFormInput1").find(".fileupload").change();149 $("#myFormInput1").find(".form-control").blur();150 $("#myFormInput1").find(".form-group").find(".checkbox-list").mouseout();151 $("#myFormInput1").find(".form-group").find(".radio-list").mouseout();152 var isNot = $("#myFormInput1").find(".form-group.has-error").length;153 if(isNot==0){154 $("#myFormInput1Error").fadeTo(1,0);155 return true;156 }else{157 $("#myFormInput1Error").fadeTo(1,1);158 return false;159 }160 });161//*****************************spanæ示表å2**************************************162 $("#myFormInput2").find(".form-control").blur(function(){163 formCheckInput(this);164 });165 $("#myFormInput2").find(".form-control").keyup(function(){166 formCheckInput(this);167 });168 $("#myFormInput2").find(".form-control").change(function(){169 formCheckInput(this);170 });171 //æ交表åæ¶éªè¯172 $("#myFormInput2").submit(function(){173 $("#myFormInput2").find(".fileupload").change();174 $("#myFormInput2").find(".form-control").blur();175 $("#myFormInput2").find(".form-group").find(".checkbox-list").mouseout();176 $("#myFormInput2").find(".form-group").find(".radio-list").mouseout();177 var isNot = $("#myFormInput2").find(".form-group.has-error").length;178 if(isNot==0){179 $("#myFormInput2Error").hide();180 return true;181 }else{182 $("#myFormInput2Error").show();183 return false;184 }185 });186//*****************************spanæ示表å3**************************************187 $("#myFormInput3").find(".form-control").blur(function(){188 formCheckInput(this);189 });190 $("#myFormInput3").find(".form-control").keyup(function(){191 formCheckInput(this);192 });193 $("#myFormInput3").find(".form-control").change(function(){194 formCheckInput(this);195 });196 //æ交表åæ¶éªè¯197 $("#myFormInput3").submit(function(){198 $("#myFormInput3").find(".fileupload").change();199 $("#myFormInput3").find(".form-control").blur();200 $("#myFormInput3").find(".form-group").find(".checkbox-list").mouseout();201 $("#myFormInput3").find(".form-group").find(".radio-list").mouseout();202 var isNot = $("#myFormInput3").find(".form-group.has-error").length;203 if(isNot==0){204 $("#myFormInput3Error").fadeTo(1,0);205 return true;206 }else{207 $("#myFormInput3Error").fadeTo(1,1);208 return false;209 }210 });211 212//*****************************spanæ示表å4**************************************213 $("#myFormInput4").find(".form-control").blur(function(){214 formCheckInput(this);215 });216 $("#myFormInput4").find(".form-control").keyup(function(){217 formCheckInput(this);218 });219 $("#myFormInput4").find(".form-control").change(function(){220 formCheckInput(this);221 });222 //æ交表åæ¶éªè¯223 $("#myFormInput4").submit(function(){224 $("#myFormInput4").find(".fileupload").change();225 $("#myFormInput4").find(".form-control").blur();226 $("#myFormInput4").find(".form-group").find(".checkbox-list").mouseout();227 $("#myFormInput4").find(".form-group").find(".radio-list").mouseout();228 var isNot = $("#myFormInput4").find(".form-group.has-error").length;229 if(isNot==0){230 $("#myFormInput4Error").fadeTo(1,0);231 return true;232 }else{233 $("#myFormInput4Error").fadeTo(1,1);234 return false;235 }236 });237//*****************************Iconsæ示表å1**************************************238 $("#myFormIcons1").find(".form-control").blur(function(){239 formCheckIcons(this);240 });241 $("#myFormIcons1").find(".form-control").keyup(function(){242 formCheckIcons(this);243 });244 $("#myFormIcons1").find(".form-control").change(function(){245 formCheckIcons(this);246 });247 248 //æ交æé®è¡¨åéªè¯249 $("#myFormIcons1").submit(function(){250 $("#myFormIcons1").find(".fileuploadIocns").change();251 $("#myFormIcons1").find(".form-control").blur();252 $("#myFormIcons1").find(".form-group").find(".checkbox-list").mouseout();253 $("#myFormIcons1").find(".form-group").find(".radio-list").mouseout();254 //ååºé误ç¶æçæ§ä»¶ç个æ°255 var isNot = $("#myFormIcons1").find(".form-group.has-error").length;256 //å¦æé误ç¶ææ§ä»¶ç个æ°ä¸º0ï¼å表示表åå¡«åæå257 if(isNot == 0){258 $("#myFormIcons1Error").fadeTo(1,0);259 return true;260 }else{261 $("#myFormIcons1Error").fadeTo(1,1);262 return false;263 }264 });265 266//*****************************Iconsæ示表å2**************************************267 $("#myFormIcons2").find(".form-control").blur(function(){268 formCheckIcons(this);269 });270 $("#myFormIcons2").find(".form-control").keyup(function(){271 formCheckIcons(this);272 });273 $("#myFormIcons2").find(".form-control").change(function(){274 formCheckIcons(this);275 });276 277 //æ交æé®è¡¨åéªè¯278 $("#myFormIcons2").submit(function(){279 $("#myFormIcons2").find(".fileuploadIocns").change();280 $("#myFormIcons2").find(".form-control").blur();281 $("#myFormIcons2").find(".form-group").find(".checkbox-list").mouseout();282 $("#myFormIcons2").find(".form-group").find(".radio-list").mouseout();283 //ååºé误ç¶æçæ§ä»¶ç个æ°284 var isNot = $("#myFormIcons2").find(".form-group.has-error").length;285 //å¦æé误ç¶ææ§ä»¶ç个æ°ä¸º0ï¼å表示表åå¡«åæå286 if(isNot == 0){287 $("#myFormIcons2Error").fadeTo(1,0);288 return true;289 }else{290 $("#myFormIcons2Error").fadeTo(1,1);291 return false;292 }293 });294 295//*****************************Iconsæ示表å3**************************************296 $("#myFormIcons3").find(".form-control").blur(function(){297 formCheckIcons(this);298 });299 $("#myFormIcons3").find(".form-control").keyup(function(){300 formCheckIcons(this);301 });302 $("#myFormIcons3").find(".form-control").change(function(){303 formCheckIcons(this);304 });305 306 //æ交æé®è¡¨åéªè¯307 $("#myFormIcons3").submit(function(){308 $("#myFormIcons3").find(".fileuploadIocns").change();309 $("#myFormIcons3").find(".form-control").blur();310 $("#myFormIcons3").find(".form-group").find(".checkbox-list").mouseout();311 $("#myFormIcons3").find(".form-group").find(".radio-list").mouseout();312 //ååºé误ç¶æçæ§ä»¶ç个æ°313 var isNot = $("#myFormIcons3").find(".form-group.has-error").length;314 //å¦æé误ç¶ææ§ä»¶ç个æ°ä¸º0ï¼å表示表åå¡«åæå315 if(isNot == 0){316 $("#myFormIcons3Error").fadeTo(1,0);317 return true;318 }else{319 $("#myFormIcons3Error").fadeTo(1,1);320 return false;321 }322 });323 324//*****************************Iconsæ示表å4**************************************325 $("#myFormIcons4").find(".form-control").blur(function(){326 formCheckIcons(this);327 });328 $("#myFormIcons4").find(".form-control").keyup(function(){329 formCheckIcons(this);330 });331 $("#myFormIcons4").find(".form-control").change(function(){332 formCheckIcons(this);333 });334 335 //æ交æé®è¡¨åéªè¯336 $("#myFormIcons4").submit(function(){337 $("#myFormIcons4").find(".fileuploadIocns").change();338 $("#myFormIcons4").find(".form-control").blur();339 $("#myFormIcons4").find(".form-group").find(".checkbox-list").mouseout();340 $("#myFormIcons4").find(".form-group").find(".radio-list").mouseout();341 //ååºé误ç¶æçæ§ä»¶ç个æ°342 var isNot = $("#myFormIcons4").find(".form-group.has-error").length;343 //å¦æé误ç¶ææ§ä»¶ç个æ°ä¸º0ï¼å表示表åå¡«åæå344 if(isNot == 0){345 $("#myFormIcons4Error").fadeTo(1,0);346 return true;347 }else{348 $("#myFormIcons4Error").fadeTo(1,1);349 return false;350 }351 });352});353//éªè¯è¡¨åï¼ä»¥è¾¹æ¡åè²åspanæåæ示é误信æ¯354function formCheckInput(object){355 var value = $(object).val();356 value = value.replace(/[ ]/g,"");357 if(value==''||!value){358 value = false;359 }360 var required = $(object).attr("required");361 var max = $(object).attr("max");362 var min = $(object).attr("min");363 var checkType = $(object).attr("checkType");364 //éªè¯å¿
å¡«365 if(required){366 //éªè¯367 if(!value||value==''){368 $(object).parents(".form-group").addClass("has-error");369 if($(object).nextAll(".help-block").length){370 $(object).nextAll(".help-block").text("è¾å
¥çå
容ä¸è½ä¸ºç©ºï¼");371 $(object).nextAll(".help-block").fadeTo(1,1);372 }else{373 $(object).parent('.input-group').nextAll(".help-block").text("è¾å
¥çå
容ä¸è½ä¸ºç©ºï¼");374 $(object).parent('.input-group').nextAll(".help-block").fadeTo(1,1);375 }376 }else{377 $(object).parents(".form-group").removeClass("has-error").addClass("has-success");378 if($(object).nextAll(".help-block").length){379 $(object).nextAll(".help-block").fadeTo(1,0);380 }else{381 $(object).parent('.input-group').nextAll(".help-block").fadeTo(1,0);382 }383 }384 }385 //éªè¯æ大é¿åº¦386 if(max){387 if(value.length>max){388 $(object).parents(".form-group").addClass("has-error");389 if($(object).nextAll(".help-block").length){390 $(object).nextAll(".help-block").text("请è¾å
¥1-"+max+"个å符ï¼");391 $(object).nextAll(".help-block").fadeTo(1,1);392 }else{393 $(object).parent('.input-group').nextAll(".help-block").text("请è¾å
¥1-"+max+"个å符ï¼");394 $(object).parent('.input-group').nextAll(".help-block").fadeTo(1,1);395 }396 }else if(!required){397 $(object).parents(".form-group").removeClass("has-error").addClass("has-success");398 if($(object).nextAll(".help-block").length){399 $(object).nextAll(".help-block").fadeTo(1,0);400 }else{401 $(object).parent('.input-group').nextAll(".help-block").fadeTo(1,0);402 }403 }404 }405 //éªè¯æå°é¿åº¦406 if(min){407 if(value.length<min&&value){408 $(object).parents(".form-group").addClass("has-error");409 if($(object).nextAll(".help-block").length){410 $(object).nextAll(".help-block").text("è¾å
¥çå
容é¿åº¦ä¸è½å°äº"+min+"个å符ï¼");411 $(object).nextAll(".help-block").fadeTo(1,1);412 }else{413 $(object).parent('.input-group').nextAll(".help-block").text("è¾å
¥çå
容é¿åº¦ä¸è½å°äº"+min+"个å符ï¼");414 $(object).parent('.input-group').nextAll(".help-block").fadeTo(1,1);415 }416 }else if(!required){417 $(object).parents(".form-group").removeClass("has-error").addClass("has-success");418 if($(object).nextAll(".help-block").length){419 $(object).nextAll(".help-block").fadeTo(1,0);420 }else{421 $(object).parent('.input-group').nextAll(".help-block").fadeTo(1,0);422 }423 }424 }425 //éªè¯ç±»å426 if(checkType){427 if(checkType=='email'){428 //é®ç®±éªè¯429 var myreg = /^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/;430 if(!myreg.test(value)&&value)431 {432 $(object).parents(".form-group").addClass("has-error");433 if($(object).nextAll(".help-block").length){434 $(object).nextAll(".help-block").text("请è¾å
¥æ£ç¡®çEmailï¼");435 $(object).nextAll(".help-block").fadeTo(1,1);436 }else{437 $(object).parent('.input-group').nextAll(".help-block").text("请è¾å
¥æ£ç¡®çEmailï¼");438 $(object).parent('.input-group').nextAll(".help-block").fadeTo(1,1);439 }440 }else if(!required){441 $(object).parents(".form-group").removeClass("has-error").addClass("has-success");442 if($(object).nextAll(".help-block").length){443 $(object).nextAll(".help-block").fadeTo(1,0);444 }else{445 $(object).parent('.input-group').nextAll(".help-block").fadeTo(1,0);446 }447 }448 }else if(checkType=='plusInt'){449 //éªè¯æ£æ´æ°æ°åé0450 var myreg = /^\+?[1-9][0-9]*$/;451 if(!myreg.test(value)&&value)452 {453 $(object).parents(".form-group").addClass("has-error");454 if($(object).nextAll(".help-block").length){455 $(object).nextAll(".help-block").text("请è¾å
¥æ£æ´æ°ï¼");456 $(object).nextAll(".help-block").fadeTo(1,1);457 }else{458 $(object).parent('.input-group').nextAll(".help-block").text("请è¾å
¥æ£æ´æ°ï¼");459 $(object).parent('.input-group').nextAll(".help-block").fadeTo(1,1);460 }461 }else if(!required){462 $(object).parents(".form-group").removeClass("has-error").addClass("has-success");463 if($(object).nextAll(".help-block").length){464 $(object).nextAll(".help-block").fadeTo(1,0);465 }else{466 $(object).parent('.input-group').nextAll(".help-block").fadeTo(1,0);467 }468 }469 }else if(checkType=='zeroInt'){470 //éªè¯æ£æ´æ°æ°åå0471 var myreg = /^\+?[0-9][0-9]*$/;472 if(!myreg.test(value)&&value)473 {474 $(object).parents(".form-group").addClass("has-error");475 if($(object).nextAll(".help-block").length){476 $(object).nextAll(".help-block").text("请è¾å
¥0ææ£æ´æ°ï¼");477 $(object).nextAll(".help-block").fadeTo(1,1);478 }else{479 $(object).parent('.input-group').nextAll(".help-block").text("请è¾å
¥0ææ£æ´æ°ï¼");480 $(object).parent('.input-group').nextAll(".help-block").fadeTo(1,1);481 }482 }else if(!required){483 $(object).parents(".form-group").removeClass("has-error").addClass("has-success");484 if($(object).nextAll(".help-block").length){485 $(object).nextAll(".help-block").fadeTo(1,0);486 }else{487 $(object).parent('.input-group').nextAll(".help-block").fadeTo(1,0);488 }489 }490 }else if(checkType.split("_")[0]=='floatNum'){491 //éªè¯å°æ°å°æ°ç¹æå¤Nä½492 var myreg = "";493 if(checkType.split("_")[1]==1){494 myreg = /^[-]?\d*\.?\d{1,1}$/;495 }else if(checkType.split("_")[1]==2){496 myreg = /^[-]?\d*\.?\d{1,2}$/;497 }else if(checkType.split("_")[1]==3){498 myreg = /^[-]?\d*\.?\d{1,3}$/;499 }else if(checkType.split("_")[1]==4){500 myreg = /^[-]?\d*\.?\d{1,4}$/;501 }else if(checkType.split("_")[1]==5){502 myreg = /^[-]?\d*\.?\d{1,5}$/;503 }else{504 myreg = /^[-]?\d*\.?\d{1,1}$/;505 }506 if(!myreg.test(value)&&value)507 {508 $(object).parents(".form-group").addClass("has-error");509 if($(object).nextAll(".help-block").length){510 $(object).nextAll(".help-block").text("请è¾å
¥å°æ°ï¼å°æ°ç¹åæå¤ä¿ç"+checkType.split("_")[1]+"ä½ï¼");511 $(object).nextAll(".help-block").fadeTo(1,1);512 }else{513 $(object).parent('.input-group').nextAll(".help-block").text("请è¾å
¥å°æ°ï¼å°æ°ç¹åæå¤ä¿ç"+checkType.split("_")[1]+"ä½ï¼");514 $(object).parent('.input-group').nextAll(".help-block").fadeTo(1,1);515 }516 }else if(!required){517 $(object).parents(".form-group").removeClass("has-error").addClass("has-success");518 if($(object).nextAll(".help-block").length){519 $(object).nextAll(".help-block").fadeTo(1,0);520 }else{521 $(object).parent('.input-group').nextAll(".help-block").fadeTo(1,0);522 }523 }524 }else if(checkType.split("_")[0]=='PfloatNum'){525 //éªè¯æ£å°æ°å°æ°ç¹æå¤Nä½526 var myreg = "";527 if(checkType.split("_")[1]==1){528 myreg = /^\d*\.?\d{1,1}$/;529 }else if(checkType.split("_")[1]==2){530 myreg = /^\d*\.?\d{1,2}$/;531 }else if(checkType.split("_")[1]==3){532 myreg = /^\d*\.?\d{1,3}$/;533 }else if(checkType.split("_")[1]==4){534 myreg = /^\d*\.?\d{1,4}$/;535 }else if(checkType.split("_")[1]==5){536 myreg = /^\d*\.?\d{1,5}$/;537 }else{538 myreg = /^\d*\.?\d{1,1}$/;539 }540 if(!myreg.test(value)&&value)541 {542 $(object).parents(".form-group").addClass("has-error");543 if($(object).nextAll(".help-block").length){544 $(object).nextAll(".help-block").text("请è¾å
¥æ£å°æ°ï¼å°æ°ç¹åæå¤ä¿ç"+checkType.split("_")[1]+"ä½ï¼");545 $(object).nextAll(".help-block").fadeTo(1,1);546 }else{547 $(object).parent('.input-group').nextAll(".help-block").text("请è¾å
¥æ£å°æ°ï¼å°æ°ç¹åæå¤ä¿ç"+checkType.split("_")[1]+"ä½ï¼");548 $(object).parent('.input-group').nextAll(".help-block").fadeTo(1,1);549 }550 }else if(!required){551 $(object).parents(".form-group").removeClass("has-error").addClass("has-success");552 if($(object).nextAll(".help-block").length){553 $(object).nextAll(".help-block").fadeTo(1,0);554 }else{555 $(object).parent('.input-group').nextAll(".help-block").fadeTo(1,0);556 }557 }558 }else if(checkType.split("_")[0]=='NfloatNum'){559 //éªè¯è´å°æ°å°æ°ç¹æå¤Nä½560 var myreg = "";561 if(checkType.split("_")[1]==1){562 myreg = /^-\d*\.?\d{1,1}$/;563 }else if(checkType.split("_")[1]==2){564 myreg = /^-\d*\.?\d{1,2}$/;565 }else if(checkType.split("_")[1]==3){566 myreg = /^-\d*\.?\d{1,3}$/;567 }else if(checkType.split("_")[1]==4){568 myreg = /^-\d*\.?\d{1,4}$/;569 }else if(checkType.split("_")[1]==5){570 myreg = /^-\d*\.?\d{1,5}$/;571 }else{572 myreg = /^-\d*\.?\d{1,1}$/;573 }574 if(!myreg.test(value)&&value)575 {576 $(object).parents(".form-group").addClass("has-error");577 if($(object).nextAll(".help-block").length){578 $(object).nextAll(".help-block").text("请è¾å
¥è´å°æ°ï¼å°æ°ç¹åæå¤ä¿ç"+checkType.split("_")[1]+"ä½ï¼");579 $(object).nextAll(".help-block").fadeTo(1,1);580 }else{581 $(object).parent('.input-group').nextAll(".help-block").text("请è¾å
¥è´å°æ°ï¼å°æ°ç¹åæå¤ä¿ç"+checkType.split("_")[1]+"ä½ï¼");582 $(object).parent('.input-group').nextAll(".help-block").fadeTo(1,1);583 }584 }else if(!required){585 $(object).parents(".form-group").removeClass("has-error").addClass("has-success");586 if($(object).nextAll(".help-block").length){587 $(object).nextAll(".help-block").fadeTo(1,0);588 }else{589 $(object).parent('.input-group').nextAll(".help-block").fadeTo(1,0);590 }591 }592 }else if(checkType=='phone'){593 //éªè¯çµè¯594 var tel=/^([0-9]{3,4}\-)?[0-9]{7,8}$/;595 var phone=/^(\+86)?1[0-9]{10}$/;596 if(!tel.test(value)&&!phone.test(value)&&value)597 {598 $(object).parents(".form-group").addClass("has-error");599 if($(object).nextAll(".help-block").length){600 $(object).nextAll(".help-block").text("请è¾å
¥æ£ç¡®çææºæ座æºå·ç ï¼");601 $(object).nextAll(".help-block").fadeTo(1,1);602 }else{603 $(object).parent('.input-group').nextAll(".help-block").text("请è¾å
¥æ£ç¡®çææºæ座æºå·ç ï¼");604 $(object).parent('.input-group').nextAll(".help-block").fadeTo(1,1);605 }606 }else if(!required){607 $(object).parents(".form-group").removeClass("has-error").addClass("has-success");608 if($(object).nextAll(".help-block").length){609 $(object).nextAll(".help-block").fadeTo(1,0);610 }else{611 $(object).parent('.input-group').nextAll(".help-block").fadeTo(1,0);612 }613 }614 }else if(checkType=='userName'){615 //éªè¯åªè½è¾å
¥æ°åï¼åæ¯ï¼ä¸å线616 var myreg =/^[a-zA-Z]{1}[0-9a-zA-Z_]{0,}$/;617 if(!myreg.test(value)&&value)618 {619 $(object).parents(".form-group").addClass("has-error");620 if($(object).nextAll(".help-block").length){621 $(object).nextAll(".help-block").text("åªè½è¾å
¥åæ¯ãæ°åæä¸å线ï¼ä¸è½ä»¥æ°ååä¸å线å¼å¤´ï¼");622 $(object).nextAll(".help-block").fadeTo(1,1);623 }else{624 $(object).parent('.input-group').nextAll(".help-block").text("åªè½è¾å
¥åæ¯ãæ°åæä¸å线ï¼ä¸è½ä»¥æ°ååä¸å线å¼å¤´ï¼");625 $(object).parent('.input-group').nextAll(".help-block").fadeTo(1,1);626 }627 }else if(!required){628 $(object).parents(".form-group").removeClass("has-error").addClass("has-success");629 if($(object).nextAll(".help-block").length){630 $(object).nextAll(".help-block").fadeTo(1,0);631 }else{632 $(object).parent('.input-group').nextAll(".help-block").fadeTo(1,0);633 }634 }635 }else if(checkType=='URL'){636 var myreg=/^[a-zA-z]+:\/\/*/;637 if(!value||value==''){638 $(object).parents(".form-group").addClass("has-error");639 if($(object).nextAll(".help-block").length){640 $(object).nextAll(".help-block").text("Rsså°åä¸è½ä¸ºç©ºï¼è¯·è¾å
¥Rsså°å");641 $(object).nextAll(".help-block").fadeTo(1,1);642 }else{643 $(object).parent('.input-group').nextAll(".help-block").text("Rsså°åä¸è½ä¸ºç©ºï¼è¯·è¾å
¥Rsså°å");644 $(object).parent('.input-group').nextAll(".help-block").fadeTo(1,1);645 }646 }else if(!myreg.test(value)&&value)647 {648 $(object).parents(".form-group").addClass("has-error");649 if($(object).nextAll(".help-block").length){650 $(object).nextAll(".help-block").text("请è¾å
¥æ£ç¡®çURlå°åï¼<http://www.***.com>");651 $(object).nextAll(".help-block").fadeTo(1,1);652 }else{653 $(object).parent('.input-group').nextAll(".help-block").text("请è¾å
¥æ£ç¡®çURlå°åï¼<http://www.***.com>");654 $(object).parent('.input-group').nextAll(".help-block").fadeTo(1,1);655 }656 }else if(!required){657 $(object).parents(".form-group").removeClass("has-error").addClass("has-success");658 if($(object).nextAll(".help-block").length){659 $(object).nextAll(".help-block").fadeTo(1,0);660 }else{661 $(object).parent('.input-group').nextAll(".help-block").fadeTo(1,0);662 }663 }664 }else if(checkType=='Directory'){665 if(!value||value==''){666 $(object).parents(".form-group").addClass("has-error");667 if($(object).nextAll(".help-block").length){668 $(object).nextAll(".help-block").text("æ件ï¼å¤¹ï¼å称ä¸è½ä¸ºç©ºï¼è¯·è¾å
¥æ件å称");669 $(object).nextAll(".help-block").fadeTo(1,1);670 }else{671 $(object).parent('.input-group').nextAll(".help-block").text("æ件ï¼å¤¹ï¼å称ä¸è½ä¸ºç©ºï¼è¯·è¾å
¥æ件å称");672 $(object).parent('.input-group').nextAll(".help-block").fadeTo(1,1);673 }674 }else if(max){675 if(value.length>max){676 $(object).parents(".form-group").addClass("has-error");677 if($(object).nextAll(".help-block").length){678 $(object).nextAll(".help-block").text("请è¾å
¥1-"+max+"个å符ï¼");679 $(object).nextAll(".help-block").fadeTo(1,1);680 }else{681 $(object).parent('.input-group').nextAll(".help-block").text("请è¾å
¥1-"+max+"个å符ï¼");682 $(object).parent('.input-group').nextAll(".help-block").fadeTo(1,1);683 }684 }else if(!required){685 $(object).parents(".form-group").removeClass("has-error").addClass("has-success");686 if($(object).nextAll(".help-block").length){687 $(object).nextAll(".help-block").fadeTo(1,0);688 }else{689 $(object).parent('.input-group').nextAll(".help-block").fadeTo(1,0);690 }691 }692 }else{693 $(object).parents(".form-group").removeClass("has-error").addClass("has-success");694 if($(object).nextAll(".help-block").length){695 $(object).nextAll(".help-block").fadeTo(1,0);696 }else{697 $(object).parent('.input-group').nextAll(".help-block").fadeTo(1,0);698 }699 }700 }else if(checkType=='oldpwd'){701 if(!value||value==''){702 $(object).parents(".form-group").addClass("has-error");703 if($(object).nextAll(".help-block").length){704 $(object).nextAll(".help-block").text("请è¾å
¥æ§å¯ç ");705 $(object).nextAll(".help-block").fadeTo(1,1);706 }else{707 $(object).parent('.input-group').nextAll(".help-block").text("请è¾å
¥åå¯ç ");708 $(object).parent('.input-group').nextAll(".help-block").fadeTo(1,1);709 }710 }else if(max){711 if(value.length>max){712 $(object).parents(".form-group").addClass("has-error");713 if($(object).nextAll(".help-block").length){714 $(object).nextAll(".help-block").text("请è¾å
¥"+min+"-"+max+"个å符");715 $(object).nextAll(".help-block").fadeTo(1,1);716 }else{717 $(object).parent('.input-group').nextAll(".help-block").text("请è¾å
¥"+min+"-"+max+"个å符");718 $(object).parent('.input-group').nextAll(".help-block").fadeTo(1,1);719 }720 }else if(value.length<min){721 $(object).parents(".form-group").addClass("has-error");722 if($(object).nextAll(".help-block").length){723 $(object).nextAll(".help-block").text("请è¾å
¥"+min+"-"+max+"个å符");724 $(object).nextAll(".help-block").fadeTo(1,1);725 }else{726 $(object).parent('.input-group').nextAll(".help-block").text("请è¾å
¥"+min+"-"+max+"个å符");727 $(object).parent('.input-group').nextAll(".help-block").fadeTo(1,1);728 }729 730 }else if(!required){731 $(object).parents(".form-group").removeClass("has-error").addClass("has-success");732 if($(object).nextAll(".help-block").length){733 $(object).nextAll(".help-block").fadeTo(1,0);734 }else{735 $(object).parent('.input-group').nextAll(".help-block").fadeTo(1,0);736 }737 }738 }else{739 $(object).parents(".form-group").removeClass("has-error").addClass("has-success");740 if($(object).nextAll(".help-block").length){741 $(object).nextAll(".help-block").fadeTo(1,0);742 }else{743 $(object).parent('.input-group').nextAll(".help-block").fadeTo(1,0);744 }745 }746 }else if(checkType=='newpwd'){747 var val=$(object).val();748 if(val.indexOf(" ")>=0){749 $(object).parents(".form-group").addClass("has-error");750 if($(object).nextAll(".help-block").length){751 $(object).nextAll(".help-block").text("请ä¸è¦è¾å
¥ç©ºæ ¼");752 $(object).nextAll(".help-block").fadeTo(1,1);753 }else{754 $(object).parent('.input-group').nextAll(".help-block").text("请ä¸è¦è¾å
¥ç©ºæ ¼");755 $(object).parent('.input-group').nextAll(".help-block").fadeTo(1,1);756 }757 }else if(!value||value==''){758 $(object).parents(".form-group").addClass("has-error");759 if($(object).nextAll(".help-block").length){760 $(object).nextAll(".help-block").text("请è¾å
¥æ°å¯ç ");761 $(object).nextAll(".help-block").fadeTo(1,1);762 }else{763 $(object).parent('.input-group').nextAll(".help-block").text("请è¾å
¥æ°å¯ç ");764 $(object).parent('.input-group').nextAll(".help-block").fadeTo(1,1);765 }766 }else if(max){767 if(value.length>max){768 $(object).parents(".form-group").addClass("has-error");769 if($(object).nextAll(".help-block").length){770 $(object).nextAll(".help-block").text("请è¾å
¥"+min+"-"+max+"个å符");771 $(object).nextAll(".help-block").fadeTo(1,1);772 }else{773 $(object).parent('.input-group').nextAll(".help-block").text("请è¾å
¥"+min+"-"+max+"个å符");774 $(object).parent('.input-group').nextAll(".help-block").fadeTo(1,1);775 }776 }else if(value.length<min){777 $(object).parents(".form-group").addClass("has-error");778 if($(object).nextAll(".help-block").length){779 $(object).nextAll(".help-block").text("请è¾å
¥"+min+"-"+max+"个å符");780 $(object).nextAll(".help-block").fadeTo(1,1);781 }else{782 $(object).parent('.input-group').nextAll(".help-block").text("请è¾å
¥"+min+"-"+max+"个å符");783 $(object).parent('.input-group').nextAll(".help-block").fadeTo(1,1);784 }785 786 }else if(!required){787 $(object).parents(".form-group").removeClass("has-error").addClass("has-success");788 if($(object).nextAll(".help-block").length){789 $(object).nextAll(".help-block").fadeTo(1,0);790 }else{791 $(object).parent('.input-group').nextAll(".help-block").fadeTo(1,0);792 }793 }794 }else{795 $(object).parents(".form-group").removeClass("has-error").addClass("has-success");796 if($(object).nextAll(".help-block").length){797 $(object).nextAll(".help-block").fadeTo(1,0);798 }else{799 $(object).parent('.input-group').nextAll(".help-block").fadeTo(1,0);800 }801 }802 }else if(checkType=='realname'){803 if(!value||value==''){804 $(object).parents(".form-group").addClass("has-error");805 if($(object).nextAll(".help-block").length){806 $(object).nextAll(".help-block").text("请æ¨è¾å
¥å§å");807 $(object).nextAll(".help-block").fadeTo(1,1);808 }else{809 $(object).parent('.input-group').nextAll(".help-block").text("请æ¨è¾å
¥å§å");810 $(object).parent('.input-group').nextAll(".help-block").fadeTo(1,1);811 }812 }else if(max){813 if(value.length>max){814 $(object).parents(".form-group").addClass("has-error");815 if($(object).nextAll(".help-block").length){816 $(object).nextAll(".help-block").text("请è¾å
¥"+min+"-"+max+"个å符");817 $(object).nextAll(".help-block").fadeTo(1,1);818 }else{819 $(object).parent('.input-group').nextAll(".help-block").text("请è¾å
¥"+min+"-"+max+"个å符");820 $(object).parent('.input-group').nextAll(".help-block").fadeTo(1,1);821 }822 }else if(value.length<min){823 $(object).parents(".form-group").addClass("has-error");824 if($(object).nextAll(".help-block").length){825 $(object).nextAll(".help-block").text("请è¾å
¥"+min+"-"+max+"个å符");826 $(object).nextAll(".help-block").fadeTo(1,1);827 }else{828 $(object).parent('.input-group').nextAll(".help-block").text("请è¾å
¥"+min+"-"+max+"个å符");829 $(object).parent('.input-group').nextAll(".help-block").fadeTo(1,1);830 }831 832 }else if(!required){833 $(object).parents(".form-group").removeClass("has-error").addClass("has-success");834 if($(object).nextAll(".help-block").length){835 $(object).nextAll(".help-block").fadeTo(1,0);836 }else{837 $(object).parent('.input-group').nextAll(".help-block").fadeTo(1,0);838 }839 }840 }else{841 $(object).parents(".form-group").removeClass("has-error").addClass("has-success");842 if($(object).nextAll(".help-block").length){843 $(object).nextAll(".help-block").fadeTo(1,0);844 }else{845 $(object).parent('.input-group').nextAll(".help-block").fadeTo(1,0);846 }847 }848 }else if(checkType=='news'){849 if(!value||value==''){850 $(object).parents(".form-group").addClass("has-error");851 if($(object).nextAll(".help-block").length){852 $(object).nextAll(".help-block").text("æ ç®å称ä¸è½ä¸ºç©ºï¼è¯·è¾å
¥æ ç®å称");853 $(object).nextAll(".help-block").fadeTo(1,1);854 }else{855 $(object).parent('.input-group').nextAll(".help-block").text("æ ç®å称ä¸è½ä¸ºç©ºï¼è¯·è¾å
¥æ ç®å称");856 $(object).parent('.input-group').nextAll(".help-block").fadeTo(1,1);857 }858 }else if(max){859 if(value.length>max){860 $(object).parents(".form-group").addClass("has-error");861 if($(object).nextAll(".help-block").length){862 $(object).nextAll(".help-block").text("请è¾å
¥"+min+"-"+max+"个å符");863 $(object).nextAll(".help-block").fadeTo(1,1);864 }else{865 $(object).parent('.input-group').nextAll(".help-block").text("请è¾å
¥"+min+"-"+max+"个å符");866 $(object).parent('.input-group').nextAll(".help-block").fadeTo(1,1);867 }868 }else if(value.length<min){869 $(object).parents(".form-group").addClass("has-error");870 if($(object).nextAll(".help-block").length){871 $(object).nextAll(".help-block").text("请è¾å
¥"+min+"-"+max+"个å符");872 $(object).nextAll(".help-block").fadeTo(1,1);873 }else{874 $(object).parent('.input-group').nextAll(".help-block").text("请è¾å
¥"+min+"-"+max+"个å符");875 $(object).parent('.input-group').nextAll(".help-block").fadeTo(1,1);876 }877 878 }else if(!required){879 $(object).parents(".form-group").removeClass("has-error").addClass("has-success");880 if($(object).nextAll(".help-block").length){881 $(object).nextAll(".help-block").fadeTo(1,0);882 }else{883 $(object).parent('.input-group').nextAll(".help-block").fadeTo(1,0);884 }885 }886 }else{887 $(object).parents(".form-group").removeClass("has-error").addClass("has-success");888 if($(object).nextAll(".help-block").length){889 $(object).nextAll(".help-block").fadeTo(1,0);890 }else{891 $(object).parent('.input-group').nextAll(".help-block").fadeTo(1,0);892 }893 }894 }else if(checkType=='sort'){895 var myreg = /^\+?[1-9][0-9]*$/;896 if(!myreg.test(value)&&value)897 {898 $(object).parents(".form-group").addClass("has-error");899 if($(object).nextAll(".help-block").length){900 $(object).nextAll(".help-block").text("请è¾å
¥æ£æ´æ°ï¼");901 $(object).nextAll(".help-block").fadeTo(1,1);902 }else{903 $(object).parent('.input-group').nextAll(".help-block").text("请è¾å
¥æ£æ´æ°");904 $(object).parent('.input-group').nextAll(".help-block").fadeTo(1,1);905 }906 }else if(!required){907 $(object).parents(".form-group").removeClass("has-error").addClass("has-success");908 if($(object).nextAll(".help-block").length){909 $(object).nextAll(".help-block").fadeTo(1,0);910 }else{911 $(object).parent('.input-group').nextAll(".help-block").fadeTo(1,0);912 }913 }914 if(!value||value==''){915 $(object).parents(".form-group").addClass("has-error");916 if($(object).nextAll(".help-block").length){917 $(object).nextAll(".help-block").text("æåºå·ä¸è½ä¸ºç©ºï¼è¯·è¾å
¥æåºå·");918 $(object).nextAll(".help-block").fadeTo(1,1);919 }else{920 $(object).parent('.input-group').nextAll(".help-block").text("æåºå·ä¸è½ä¸ºç©ºï¼è¯·è¾å
¥æåºå·");921 $(object).parent('.input-group').nextAll(".help-block").fadeTo(1,1);922 }923 }else if(max){924 if(value.length>max){925 $(object).parents(".form-group").addClass("has-error");926 if($(object).nextAll(".help-block").length){927 $(object).nextAll(".help-block").text("请è¾å
¥"+min+"-"+max+"个å符");928 $(object).nextAll(".help-block").fadeTo(1,1);929 }else{930 $(object).parent('.input-group').nextAll(".help-block").text("请è¾å
¥"+min+"-"+max+"个å符");931 $(object).parent('.input-group').nextAll(".help-block").fadeTo(1,1);932 }933 }else if(value.length<min){934 $(object).parents(".form-group").addClass("has-error");935 if($(object).nextAll(".help-block").length){936 $(object).nextAll(".help-block").text("请è¾å
¥"+min+"-"+max+"个å符");937 $(object).nextAll(".help-block").fadeTo(1,1);938 }else{939 $(object).parent('.input-group').nextAll(".help-block").text("请è¾å
¥"+min+"-"+max+"个å符");940 $(object).parent('.input-group').nextAll(".help-block").fadeTo(1,1);941 }942 943 }else if(!required){944 $(object).parents(".form-group").removeClass("has-error").addClass("has-success");945 if($(object).nextAll(".help-block").length){946 $(object).nextAll(".help-block").fadeTo(1,0);947 }else{948 $(object).parent('.input-group').nextAll(".help-block").fadeTo(1,0);949 }950 }951 }else{952 $(object).parents(".form-group").removeClass("has-error").addClass("has-success");953 if($(object).nextAll(".help-block").length){954 $(object).nextAll(".help-block").fadeTo(1,0);955 }else{956 $(object).parent('.input-group').nextAll(".help-block").fadeTo(1,0);957 }958 }959 }else if(checkType=='loginname'){960 var myreg =/^[a-zA-Z]{1}[0-9a-zA-Z_]{0,}$/;961 if(!myreg.test(value)&&value)962 {963 $(object).parents(".form-group").addClass("has-error");964 if($(object).nextAll(".help-block").length){965 $(object).nextAll(".help-block").text("请è¾å
¥"+min+"-"+max+"个åæ¯ãæ°åæä¸å线ï¼ä¸è½ä»¥æ°ååä¸å线å¼å¤´");966 $(object).nextAll(".help-block").fadeTo(1,1);967 }else{968 $(object).parent('.input-group').nextAll(".help-block").text("请è¾å
¥"+min+"-"+max+"个åæ¯ãæ°åæä¸å线ï¼ä¸è½ä»¥æ°ååä¸å线å¼å¤´");969 $(object).parent('.input-group').nextAll(".help-block").fadeTo(1,1);970 }971 }else if(!required){972 $(object).parents(".form-group").removeClass("has-error").addClass("has-success");973 if($(object).nextAll(".help-block").length){974 $(object).nextAll(".help-block").fadeTo(1,0);975 }else{976 $(object).parent('.input-group').nextAll(".help-block").fadeTo(1,0);977 }978 }979 if(!value||value==''){980 $(object).parents(".form-group").addClass("has-error");981 if($(object).nextAll(".help-block").length){982 $(object).nextAll(".help-block").text("ç¨æ·ç»å½åä¸è½ä¸ºç©ºï¼è¯·è¾å
¥");983 $(object).nextAll(".help-block").fadeTo(1,1);984 }else{985 $(object).parent('.input-group').nextAll(".help-block").text("ç¨æ·ç»å½åä¸è½ä¸ºç©ºï¼è¯·è¾å
¥");986 $(object).parent('.input-group').nextAll(".help-block").fadeTo(1,1);987 }988 }else if(max){989 if(value.length>max){990 $(object).parents(".form-group").addClass("has-error");991 if($(object).nextAll(".help-block").length){992 $(object).nextAll(".help-block").text("请è¾å
¥"+min+"-"+max+"个åæ¯ãæ°åæä¸å线ï¼ä¸è½ä»¥æ°ååä¸å线å¼å¤´");993 $(object).nextAll(".help-block").fadeTo(1,1);994 }else{995 $(object).parent('.input-group').nextAll(".help-block").text("请è¾å
¥"+min+"-"+max+"个åæ¯ãæ°åæä¸å线ï¼ä¸è½ä»¥æ°ååä¸å线å¼å¤´");996 $(object).parent('.input-group').nextAll(".help-block").fadeTo(1,1);997 }998 }else if(value.length<min){999 $(object).parents(".form-group").addClass("has-error");1000 if($(object).nextAll(".help-block").length){1001 $(object).nextAll(".help-block").text("请è¾å
¥"+min+"-"+max+"个åæ¯ãæ°åæä¸å线ï¼ä¸è½ä»¥æ°ååä¸å线å¼å¤´");1002 $(object).nextAll(".help-block").fadeTo(1,1);1003 }else{1004 $(object).parent('.input-group').nextAll(".help-block").text("请è¾å
¥"+min+"-"+max+"个åæ¯ãæ°åæä¸å线ï¼ä¸è½ä»¥æ°ååä¸å线å¼å¤´");1005 $(object).parent('.input-group').nextAll(".help-block").fadeTo(1,1);1006 }1007 1008 }else if(!required){1009 $(object).parents(".form-group").removeClass("has-error").addClass("has-success");1010 if($(object).nextAll(".help-block").length){1011 $(object).nextAll(".help-block").fadeTo(1,0);1012 }else{1013 $(object).parent('.input-group').nextAll(".help-block").fadeTo(1,0);1014 }1015 }1016 }else{1017 $(object).parents(".form-group").removeClass("has-error").addClass("has-success");1018 if($(object).nextAll(".help-block").length){1019 $(object).nextAll(".help-block").fadeTo(1,0);1020 }else{1021 $(object).parent('.input-group').nextAll(".help-block").fadeTo(1,0);1022 }1023 }1024 }else if(checkType=='truename'){1025 if(!value||value==''){1026 $(object).parents(".form-group").addClass("has-error");1027 if($(object).nextAll(".help-block").length){1028 $(object).nextAll(".help-block").text("å§åä¸è½ä¸ºç©ºï¼è¯·è¾å
¥");1029 $(object).nextAll(".help-block").fadeTo(1,1);1030 }else{1031 $(object).parent('.input-group').nextAll(".help-block").text("å§åä¸è½ä¸ºç©ºï¼è¯·è¾å
¥");1032 $(object).parent('.input-group').nextAll(".help-block").fadeTo(1,1);1033 }1034 }else if(max){1035 if(value.length>max){1036 $(object).parents(".form-group").addClass("has-error");1037 if($(object).nextAll(".help-block").length){1038 $(object).nextAll(".help-block").text("请è¾å
¥"+min+"-"+max+"个å符");1039 $(object).nextAll(".help-block").fadeTo(1,1);1040 }else{1041 $(object).parent('.input-group').nextAll(".help-block").text("请è¾å
¥"+min+"-"+max+"个å符");1042 $(object).parent('.input-group').nextAll(".help-block").fadeTo(1,1);1043 }1044 }else if(value.length<min){1045 $(object).parents(".form-group").addClass("has-error");1046 if($(object).nextAll(".help-block").length){1047 $(object).nextAll(".help-block").text("请è¾å
¥"+min+"-"+max+"个å符");1048 $(object).nextAll(".help-block").fadeTo(1,1);1049 }else{1050 $(object).parent('.input-group').nextAll(".help-block").text("请è¾å
¥"+min+"-"+max+"个å符");1051 $(object).parent('.input-group').nextAll(".help-block").fadeTo(1,1);1052 }1053 1054 }else if(!required){1055 $(object).parents(".form-group").removeClass("has-error").addClass("has-success");1056 if($(object).nextAll(".help-block").length){1057 $(object).nextAll(".help-block").fadeTo(1,0);1058 }else{1059 $(object).parent('.input-group').nextAll(".help-block").fadeTo(1,0);1060 }1061 }1062 }else{1063 $(object).parents(".form-group").removeClass("has-error").addClass("has-success");1064 if($(object).nextAll(".help-block").length){1065 $(object).nextAll(".help-block").fadeTo(1,0);1066 }else{1067 $(object).parent('.input-group').nextAll(".help-block").fadeTo(1,0);1068 }1069 }1070 }else if(checkType=='groupname'){1071 if(!value||value==''){1072 $(object).parents(".form-group").addClass("has-error");1073 if($(object).nextAll(".help-block").length){1074 $(object).nextAll(".help-block").text("ç¨æ·ç»å称ä¸è½ä¸ºç©ºï¼è¯·è¾å
¥");1075 $(object).nextAll(".help-block").fadeTo(1,1);1076 }else{1077 $(object).parent('.input-group').nextAll(".help-block").text("ç¨æ·ç»å称ä¸è½ä¸ºç©ºï¼è¯·è¾å
¥");1078 $(object).parent('.input-group').nextAll(".help-block").fadeTo(1,1);1079 }1080 }else if(max){1081 if(value.length>max){1082 $(object).parents(".form-group").addClass("has-error");1083 if($(object).nextAll(".help-block").length){1084 $(object).nextAll(".help-block").text("请è¾å
¥"+min+"-"+max+"个å符");1085 $(object).nextAll(".help-block").fadeTo(1,1);1086 }else{1087 $(object).parent('.input-group').nextAll(".help-block").text("请è¾å
¥"+min+"-"+max+"个å符");1088 $(object).parent('.input-group').nextAll(".help-block").fadeTo(1,1);1089 }1090 }else if(value.length<min){1091 $(object).parents(".form-group").addClass("has-error");1092 if($(object).nextAll(".help-block").length){1093 $(object).nextAll(".help-block").text("请è¾å
¥"+min+"-"+max+"个å符");1094 $(object).nextAll(".help-block").fadeTo(1,1);1095 }else{1096 $(object).parent('.input-group').nextAll(".help-block").text("请è¾å
¥"+min+"-"+max+"个å符");1097 $(object).parent('.input-group').nextAll(".help-block").fadeTo(1,1);1098 }1099 1100 }else if(!required){1101 $(object).parents(".form-group").removeClass("has-error").addClass("has-success");1102 if($(object).nextAll(".help-block").length){1103 $(object).nextAll(".help-block").fadeTo(1,0);1104 }else{1105 $(object).parent('.input-group').nextAll(".help-block").fadeTo(1,0);1106 }1107 }1108 }else{1109 $(object).parents(".form-group").removeClass("has-error").addClass("has-success");1110 if($(object).nextAll(".help-block").length){1111 $(object).nextAll(".help-block").fadeTo(1,0);1112 }else{1113 $(object).parent('.input-group').nextAll(".help-block").fadeTo(1,0);1114 }1115 }1116 }else if(checkType=='size'){1117 var myreg = /^\+?[1-9][0-9]*$/;1118 if(!myreg.test(value)&&value)1119 {1120 $(object).parents(".form-group").addClass("has-error");1121 if($(object).nextAll(".help-block").length){1122 $(object).nextAll(".help-block").text("请è¾å
¥æ£æ´æ°ï¼");1123 $(object).nextAll(".help-block").fadeTo(1,1);1124 }else{1125 $(object).parent('.input-group').nextAll(".help-block").text("请è¾å
¥æ£æ´æ°");1126 $(object).parent('.input-group').nextAll(".help-block").fadeTo(1,1);1127 }1128 }else if(!required){1129 $(object).parents(".form-group").removeClass("has-error").addClass("has-success");1130 if($(object).nextAll(".help-block").length){1131 $(object).nextAll(".help-block").fadeTo(1,0);1132 }else{1133 $(object).parent('.input-group').nextAll(".help-block").fadeTo(1,0);1134 }1135 }1136 if(!value||value==''){1137 $(object).parents(".form-group").addClass("has-error");1138 if($(object).nextAll(".help-block").length){1139 $(object).nextAll(".help-block").text("空é´å¤§å°ä¸è½ä¸ºç©ºï¼è¯·è¾å
¥");1140 $(object).nextAll(".help-block").fadeTo(1,1);1141 }else{1142 $(object).parent('.input-group').nextAll(".help-block").text("空é´å¤§å°ä¸è½ä¸ºç©ºï¼è¯·è¾å
¥");1143 $(object).parent('.input-group').nextAll(".help-block").fadeTo(1,1);1144 }1145 }else if(max){1146 if(value.length>max){1147 $(object).parents(".form-group").addClass("has-error");1148 if($(object).nextAll(".help-block").length){1149 $(object).nextAll(".help-block").text("请è¾å
¥"+min+"-"+max+"个æ£æ´æ°");1150 $(object).nextAll(".help-block").fadeTo(1,1);1151 }else{1152 $(object).parent('.input-group').nextAll(".help-block").text("请è¾å
¥"+min+"-"+max+"个æ£æ´æ°");1153 $(object).parent('.input-group').nextAll(".help-block").fadeTo(1,1);1154 }1155 }else if(value.length<min){1156 $(object).parents(".form-group").addClass("has-error");1157 if($(object).nextAll(".help-block").length){1158 $(object).nextAll(".help-block").text("请è¾å
¥"+min+"-"+max+"个æ£æ´æ°");1159 $(object).nextAll(".help-block").fadeTo(1,1);1160 }else{1161 $(object).parent('.input-group').nextAll(".help-block").text("请è¾å
¥"+min+"-"+max+"个æ£æ´æ°");1162 $(object).parent('.input-group').nextAll(".help-block").fadeTo(1,1);1163 }1164 1165 }else if(!required){1166 $(object).parents(".form-group").removeClass("has-error").addClass("has-success");1167 if($(object).nextAll(".help-block").length){1168 $(object).nextAll(".help-block").fadeTo(1,0);1169 }else{1170 $(object).parent('.input-group').nextAll(".help-block").fadeTo(1,0);1171 }1172 }1173 }else{1174 $(object).parents(".form-group").removeClass("has-error").addClass("has-success");1175 if($(object).nextAll(".help-block").length){1176 $(object).nextAll(".help-block").fadeTo(1,0);1177 }else{1178 $(object).parent('.input-group').nextAll(".help-block").fadeTo(1,0);1179 }1180 }1181 }1182 }1183}1184//éªè¯è¡¨åï¼ä»¥å¾æ åæ°æ³¡å½¢å¼æ示é误信æ¯1185function formCheckIcons(object){1186 var value = $(object).val();1187 value = value.replace(/[ ]/g,"");1188 if(value==''||!value){1189 value = false; 1190 }1191 var required = $(object).attr("required");1192 var max = $(object).attr("max");1193 var min = $(object).attr("min");1194 var checkType = $(object).attr("checkType");1195 //éªè¯å¿
å¡«1196 if(required){1197 //éªè¯1198 if(!value){1199 $(object).parents(".form-group").addClass("has-error");1200 if($(object).prevAll("i").length){1201 $(object).prevAll("i").attr("data-original-title","è¾å
¥çå
容ä¸è½ä¸ºç©ºï¼");1202 $(object).prevAll("i").addClass("fa-warning");1203 }else{1204 $(object).parent('.input-group').prevAll("i").attr("data-original-title","è¾å
¥çå
容ä¸è½ä¸ºç©ºï¼");1205 $(object).parent('.input-group').prevAll("i").addClass("fa-warning");1206 }1207 }else{1208 $(object).parents(".form-group").removeClass("has-error").addClass("has-success");1209 if($(object).prevAll("i").length){1210 $(object).prevAll("i").attr("data-original-title","");1211 $(object).prevAll("i").removeClass("fa-warning").addClass("fa-check"); 1212 }else{1213 $(object).parent('.input-group').prevAll("i").attr("data-original-title","");1214 $(object).parent('.input-group').prevAll("i").removeClass("fa-warning").addClass("fa-check");1215 }1216 }1217 }1218 //éªè¯æ大é¿åº¦1219 if(max){1220 if(value.length>max){1221 $(object).parents(".form-group").addClass("has-error");1222 if($(object).prevAll("i").length){1223 $(object).prevAll("i").attr("data-original-title","è¾å
¥çå
容é¿åº¦ä¸è½å¤§äº"+max+"ï¼");1224 $(object).prevAll("i").addClass("fa-warning");1225 }else{1226 $(object).parent('.input-group').prevAll("i").attr("data-original-title","è¾å
¥çå
容é¿åº¦ä¸è½å¤§äº"+max+"ï¼");1227 $(object).parent('.input-group').prevAll("i").addClass("fa-warning");1228 }1229 }else if(!required){1230 $(object).parents(".form-group").removeClass("has-error").addClass("has-success");1231 if($(object).prevAll("i").length){1232 $(object).prevAll("i").attr("data-original-title","");1233 $(object).prevAll("i").removeClass("fa-warning").addClass("fa-check");1234 }else{1235 $(object).parent('.input-group').prevAll("i").attr("data-original-title","");1236 $(object).parent('.input-group').prevAll("i").removeClass("fa-warning").addClass("fa-check");1237 }1238 }1239 }1240 //éªè¯æå°é¿åº¦1241 if(min){1242 if(value.length<min&&value){1243 $(object).parents(".form-group").addClass("has-error");1244 1245 if($(object).prevAll("i").length){1246 $(object).prevAll("i").attr("data-original-title","è¾å
¥çå
容é¿åº¦ä¸è½å°äº"+min+"ï¼");1247 $(object).prevAll("i").addClass("fa-warning");1248 }else{1249 $(object).parent('.input-group').prevAll("i").attr("data-original-title","è¾å
¥çå
容é¿åº¦ä¸è½å°äº"+min+"ï¼");1250 $(object).parent('.input-group').prevAll("i").addClass("fa-warning");1251 }1252 }else if(!required){1253 $(object).parents(".form-group").removeClass("has-error").addClass("has-success");1254 if($(object).prevAll("i").length){1255 $(object).prevAll("i").attr("data-original-title","");1256 $(object).prevAll("i").removeClass("fa-warning").addClass("fa-check");1257 }else{1258 $(object).parent('.input-group').prevAll("i").attr("data-original-title","");1259 $(object).parent('.input-group').prevAll("i").removeClass("fa-warning").addClass("fa-check");1260 }1261 }1262 }1263 //éªè¯ç±»å1264 if(checkType){1265 if(checkType=='email'){1266 //é®ç®±éªè¯1267 var myreg = /^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/;1268 if(!myreg.test(value)&&value)1269 {1270 $(object).parents(".form-group").addClass("has-error");1271 1272 if($(object).prevAll("i").length){1273 $(object).prevAll("i").attr("data-original-title","请è¾å
¥æ£ç¡®çEmailå°åï¼");1274 $(object).prevAll("i").addClass("fa-warning");1275 }else{1276 $(object).parent('.input-group').prevAll("i").attr("data-original-title","请è¾å
¥æ£ç¡®çEmailå°åï¼");1277 $(object).parent('.input-group').prevAll("i").addClass("fa-warning");1278 }1279 }else if(!required){1280 $(object).parents(".form-group").removeClass("has-error").addClass("has-success");1281 if($(object).prevAll("i").length){1282 $(object).prevAll("i").attr("data-original-title","");1283 $(object).prevAll("i").removeClass("fa-warning").addClass("fa-check");1284 }else{1285 $(object).parent('.input-group').prevAll("i").attr("data-original-title","");1286 $(object).parent('.input-group').prevAll("i").removeClass("fa-warning").addClass("fa-check");1287 }1288 }1289 }else if(checkType=='plusInt'){1290 //éªè¯æ£æ´æ°æ°å1291 var myreg = /^\+?[1-9][0-9]*$/;1292 if(!myreg.test(value)&&value)1293 {1294 $(object).parents(".form-group").addClass("has-error");1295 1296 if($(object).prevAll("i").length){1297 $(object).prevAll("i").attr("data-original-title","请è¾å
¥æ£æ´æ°ï¼");1298 $(object).prevAll("i").addClass("fa-warning");1299 }else{1300 $(object).parent('.input-group').prevAll("i").attr("data-original-title","请è¾å
¥æ£æ´æ°ï¼");1301 $(object).parent('.input-group').prevAll("i").addClass("fa-warning");1302 }1303 }else if(!required){1304 $(object).parents(".form-group").removeClass("has-error").addClass("has-success");1305 if($(object).prevAll("i").length){1306 $(object).prevAll("i").attr("data-original-title","");1307 $(object).prevAll("i").removeClass("fa-warning").addClass("fa-check");1308 }else{1309 $(object).parent('.input-group').prevAll("i").attr("data-original-title","");1310 $(object).parent('.input-group').prevAll("i").removeClass("fa-warning").addClass("fa-check");1311 }1312 }1313 }else if(checkType=='zeroInt'){1314 //éªè¯æ£æ´æ°æ°åå
æ¬01315 var myreg = /^\+?[0-9][0-9]*$/;1316 if(!myreg.test(value)&&value)1317 {1318 $(object).parents(".form-group").addClass("has-error");1319 1320 if($(object).prevAll("i").length){1321 $(object).prevAll("i").attr("data-original-title","请è¾å
¥0ææ£æ´æ°ï¼");1322 $(object).prevAll("i").addClass("fa-warning");1323 }else{1324 $(object).parent('.input-group').prevAll("i").attr("data-original-title","请è¾å
¥0ææ£æ´æ°ï¼");1325 $(object).parent('.input-group').prevAll("i").addClass("fa-warning");1326 }1327 }else if(!required){1328 $(object).parents(".form-group").removeClass("has-error").addClass("has-success");1329 if($(object).prevAll("i").length){1330 $(object).prevAll("i").attr("data-original-title","");1331 $(object).prevAll("i").removeClass("fa-warning").addClass("fa-check");1332 }else{1333 $(object).parent('.input-group').prevAll("i").attr("data-original-title","");1334 $(object).parent('.input-group').prevAll("i").removeClass("fa-warning").addClass("fa-check");1335 }1336 }1337 }else if(checkType.split("_")[0]=='floatNum'){1338 //éªè¯å°æ°å°æ°ç¹æå¤Nä½1339 var myreg = "";1340 if(checkType.split("_")[1]==1){1341 myreg = /^[-]?\d*\.?\d{1,1}$/;1342 }else if(checkType.split("_")[1]==2){1343 myreg = /^[-]?\d*\.?\d{1,2}$/;1344 }else if(checkType.split("_")[1]==3){1345 myreg = /^[-]?\d*\.?\d{1,3}$/;1346 }else if(checkType.split("_")[1]==4){1347 myreg = /^[-]?\d*\.?\d{1,4}$/;1348 }else if(checkType.split("_")[1]==5){1349 myreg = /^[-]?\d*\.?\d{1,5}$/;1350 }else{1351 myreg = /^[-]?\d*\.?\d{1,1}$/;1352 }1353 if(!myreg.test(value)&&value)1354 {1355 $(object).parents(".form-group").addClass("has-error");1356 1357 if($(object).prevAll("i").length){1358 $(object).prevAll("i").attr("data-original-title","请è¾å
¥å°æ°ï¼å°æ°ç¹åæå¤ä¿ç"+checkType.split("_")[1]+"ä½ï¼");1359 $(object).prevAll("i").addClass("fa-warning");1360 }else{1361 $(object).parent('.input-group').prevAll("i").attr("data-original-title","请è¾å
¥å°æ°ï¼å°æ°ç¹åæå¤ä¿ç"+checkType.split("_")[1]+"ä½ï¼");1362 $(object).parent('.input-group').prevAll("i").addClass("fa-warning");1363 }1364 }else if(!required){1365 $(object).parents(".form-group").removeClass("has-error").addClass("has-success");1366 if($(object).prevAll("i").length){1367 $(object).prevAll("i").attr("data-original-title","");1368 $(object).prevAll("i").removeClass("fa-warning").addClass("fa-check");1369 }else{1370 $(object).parent('.input-group').prevAll("i").attr("data-original-title","");1371 $(object).parent('.input-group').prevAll("i").removeClass("fa-warning").addClass("fa-check");1372 }1373 }1374 }else if(checkType.split("_")[0]=='PfloatNum'){1375 //éªè¯æ£å°æ°å°æ°ç¹æå¤Nä½1376 var myreg = "";1377 if(checkType.split("_")[1]==1){1378 myreg = /^\d*\.?\d{1,1}$/;1379 }else if(checkType.split("_")[1]==2){1380 myreg = /^\d*\.?\d{1,2}$/;1381 }else if(checkType.split("_")[1]==3){1382 myreg = /^\d*\.?\d{1,3}$/;1383 }else if(checkType.split("_")[1]==4){1384 myreg = /^\d*\.?\d{1,4}$/;1385 }else if(checkType.split("_")[1]==5){1386 myreg = /^\d*\.?\d{1,5}$/;1387 }else{1388 myreg = /^\d*\.?\d{1,1}$/;1389 }1390 if(!myreg.test(value)&&value)1391 {1392 $(object).parents(".form-group").addClass("has-error");1393 1394 if($(object).prevAll("i").length){1395 $(object).prevAll("i").attr("data-original-title","请è¾å
¥æ£å°æ°ï¼å°æ°ç¹åæå¤ä¿ç"+checkType.split("_")[1]+"ä½ï¼");1396 $(object).prevAll("i").addClass("fa-warning");1397 }else{1398 $(object).parent('.input-group').prevAll("i").attr("data-original-title","请è¾å
¥æ£å°æ°ï¼å°æ°ç¹åæå¤ä¿ç"+checkType.split("_")[1]+"ä½ï¼");1399 $(object).parent('.input-group').prevAll("i").addClass("fa-warning");1400 }1401 }else if(!required){1402 $(object).parents(".form-group").removeClass("has-error").addClass("has-success");1403 if($(object).prevAll("i").length){1404 $(object).prevAll("i").attr("data-original-title","");1405 $(object).prevAll("i").removeClass("fa-warning").addClass("fa-check");1406 }else{1407 $(object).parent('.input-group').prevAll("i").attr("data-original-title","");1408 $(object).parent('.input-group').prevAll("i").removeClass("fa-warning").addClass("fa-check");1409 }1410 }1411 }else if(checkType.split("_")[0]=='NfloatNum'){1412 //éªè¯è´å°æ°å°æ°ç¹æå¤Nä½1413 var myreg = "";1414 if(checkType.split("_")[1]==1){1415 myreg = /^-\d*\.?\d{1,1}$/;1416 }else if(checkType.split("_")[1]==2){1417 myreg = /^-\d*\.?\d{1,2}$/;1418 }else if(checkType.split("_")[1]==3){1419 myreg = /^-\d*\.?\d{1,3}$/;1420 }else if(checkType.split("_")[1]==4){1421 myreg = /^-\d*\.?\d{1,4}$/;1422 }else if(checkType.split("_")[1]==5){1423 myreg = /^-\d*\.?\d{1,5}$/;1424 }else{1425 myreg = /^-\d*\.?\d{1,1}$/;1426 }1427 if(!myreg.test(value)&&value)1428 {1429 $(object).parents(".form-group").addClass("has-error");1430 1431 if($(object).prevAll("i").length){1432 $(object).prevAll("i").attr("data-original-title","请è¾å
¥è´å°æ°ï¼å°æ°ç¹åæå¤ä¿ç"+checkType.split("_")[1]+"ä½ï¼");1433 $(object).prevAll("i").addClass("fa-warning");1434 }else{1435 $(object).parent('.input-group').prevAll("i").attr("data-original-title","请è¾å
¥è´å°æ°ï¼å°æ°ç¹åæå¤ä¿ç"+checkType.split("_")[1]+"ä½ï¼");1436 $(object).parent('.input-group').prevAll("i").addClass("fa-warning");1437 }1438 }else if(!required){1439 $(object).parents(".form-group").removeClass("has-error").addClass("has-success");1440 if($(object).prevAll("i").length){1441 $(object).prevAll("i").attr("data-original-title","");1442 $(object).prevAll("i").removeClass("fa-warning").addClass("fa-check");1443 }else{1444 $(object).parent('.input-group').prevAll("i").attr("data-original-title","");1445 $(object).parent('.input-group').prevAll("i").removeClass("fa-warning").addClass("fa-check");1446 }1447 }1448 }else if(checkType=='phone'){1449 //éªè¯çµè¯1450 var tel=/^([0-9]{3,4}\-)?[0-9]{7,8}$/;1451 var phone=/^(\+86)?1[0-9]{10}$/;1452 if(!tel.test(value)&&!phone.test(value)&&value)1453 {1454 $(object).parents(".form-group").addClass("has-error");1455 1456 if($(object).prevAll("i").length){1457 $(object).prevAll("i").attr("data-original-title","请è¾å
¥æ£ç¡®çææºæ座æºå·ç ï¼");1458 $(object).prevAll("i").addClass("fa-warning");1459 }else{1460 $(object).parent('.input-group').prevAll("i").attr("data-original-title","请è¾å
¥æ£ç¡®çææºæ座æºå·ç ï¼");1461 $(object).parent('.input-group').prevAll("i").addClass("fa-warning");1462 }1463 }else if(!required){1464 $(object).parents(".form-group").removeClass("has-error").addClass("has-success");1465 if($(object).prevAll("i").length){1466 $(object).prevAll("i").attr("data-original-title","");1467 $(object).prevAll("i").removeClass("fa-warning").addClass("fa-check");1468 }else{1469 $(object).parent('.input-group').prevAll("i").attr("data-original-title","");1470 $(object).parent('.input-group').prevAll("i").removeClass("fa-warning").addClass("fa-check");1471 }1472 }1473 }else if(checkType=='userName'){1474 //éªè¯åªè½è¾å
¥æ°åï¼åæ¯ï¼ä¸å线1475 var myreg =/^[a-zA-Z]{1}[0-9a-zA-Z_]{0,}$/;1476 if(!myreg.test(value)&&value)1477 {1478 $(object).parents(".form-group").addClass("has-error");1479 1480 if($(object).prevAll("i").length){1481 $(object).prevAll("i").attr("data-original-title","åªè½è¾å
¥åæ¯ãæ°åæä¸å线ï¼ä¸è½ä»¥æ°ååä¸å线å¼å¤´ï¼");1482 $(object).prevAll("i").addClass("fa-warning");1483 }else{1484 $(object).parent('.input-group').prevAll("i").attr("data-original-title","åªè½è¾å
¥åæ¯ãæ°åæä¸å线ï¼ä¸è½ä»¥æ°ååä¸å线å¼å¤´ï¼");1485 $(object).parent('.input-group').prevAll("i").addClass("fa-warning");1486 }1487 }else if(!required){1488 $(object).parents(".form-group").removeClass("has-error").addClass("has-success");1489 if($(object).prevAll("i").length){1490 $(object).prevAll("i").attr("data-original-title","");1491 $(object).prevAll("i").removeClass("fa-warning").addClass("fa-check");1492 }else{1493 $(object).parent('.input-group').prevAll("i").attr("data-original-title","");1494 $(object).parent('.input-group').prevAll("i").removeClass("fa-warning").addClass("fa-check");1495 }1496 }else if(checkType=='URL'){1497 var myreg=/^[a-zA-z]+:\/\/*/;1498 if(!value||value==''){1499 $(object).parents(".form-group").addClass("has-error");1500 if($(object).nextAll(".help-block").length){1501 $(object).nextAll(".help-block").text("Rsså°åä¸è½ä¸ºç©ºï¼è¯·è¾å
¥Rsså°å");1502 $(object).nextAll(".help-block").fadeTo(1,1);1503 }else{1504 $(object).parent('.input-group').nextAll(".help-block").text("Rsså°åä¸è½ä¸ºç©ºï¼è¯·è¾å
¥Rsså°å");1505 $(object).parent('.input-group').nextAll(".help-block").fadeTo(1,1);1506 }1507 }else if(!myreg.test(value)&&value)1508 {1509 $(object).parents(".form-group").addClass("has-error");1510 if($(object).nextAll(".help-block").length){1511 $(object).nextAll(".help-block").text("请è¾å
¥æ£ç¡®çURlå°åï¼<http://www.***.com>");1512 $(object).nextAll(".help-block").fadeTo(1,1);1513 }else{1514 $(object).parent('.input-group').nextAll(".help-block").text("请è¾å
¥æ£ç¡®çURlå°åï¼<http://www.***.com>");1515 $(object).parent('.input-group').nextAll(".help-block").fadeTo(1,1);1516 }1517 }else if(!required){1518 $(object).parents(".form-group").removeClass("has-error").addClass("has-success");1519 if($(object).nextAll(".help-block").length){1520 $(object).nextAll(".help-block").fadeTo(1,0);1521 }else{1522 $(object).parent('.input-group').nextAll(".help-block").fadeTo(1,0);1523 }1524 }1525 }else if(checkType=='Directory'){1526 if(!value||value==''){1527 $(object).parents(".form-group").addClass("has-error");1528 if($(object).nextAll(".help-block").length){1529 $(object).nextAll(".help-block").text("æ件ï¼å¤¹ï¼å称ä¸è½ä¸ºç©ºï¼è¯·è¾å
¥æ件å称");1530 $(object).nextAll(".help-block").fadeTo(1,1);1531 }else{1532 $(object).parent('.input-group').nextAll(".help-block").text("æ件ï¼å¤¹ï¼å称ä¸è½ä¸ºç©ºï¼è¯·è¾å
¥æ件å称");1533 $(object).parent('.input-group').nextAll(".help-block").fadeTo(1,1);1534 }1535 }else if(max){1536 if(value.length>max){1537 $(object).parents(".form-group").addClass("has-error");1538 if($(object).nextAll(".help-block").length){1539 $(object).nextAll(".help-block").text("请è¾å
¥1-"+max+"个å符ï¼");1540 $(object).nextAll(".help-block").fadeTo(1,1);1541 }else{1542 $(object).parent('.input-group').nextAll(".help-block").text("请è¾å
¥1-"+max+"个å符ï¼");1543 $(object).parent('.input-group').nextAll(".help-block").fadeTo(1,1);1544 }1545 }else if(!required){1546 $(object).parents(".form-group").removeClass("has-error").addClass("has-success");1547 if($(object).nextAll(".help-block").length){1548 $(object).nextAll(".help-block").fadeTo(1,0);1549 }else{1550 $(object).parent('.input-group').nextAll(".help-block").fadeTo(1,0);1551 }1552 }1553 }else{1554 $(object).parents(".form-group").removeClass("has-error").addClass("has-success");1555 if($(object).nextAll(".help-block").length){1556 $(object).nextAll(".help-block").fadeTo(1,0);1557 }else{1558 $(object).parent('.input-group').nextAll(".help-block").fadeTo(1,0);1559 }1560 }1561 }else if(checkType=='oldpwd'){1562 if(!value||value==''){1563 $(object).parents(".form-group").addClass("has-error");1564 if($(object).nextAll(".help-block").length){1565 $(object).nextAll(".help-block").text("请è¾å
¥æ§å¯ç ");1566 $(object).nextAll(".help-block").fadeTo(1,1);1567 }else{1568 $(object).parent('.input-group').nextAll(".help-block").text("请è¾å
¥æ§å¯ç ");1569 $(object).parent('.input-group').nextAll(".help-block").fadeTo(1,1);1570 }1571 }else if(max){1572 if(value.length>max){1573 $(object).parents(".form-group").addClass("has-error");1574 if($(object).nextAll(".help-block").length){1575 $(object).nextAll(".help-block").text("请è¾å
¥"+min+"-"+max+"个å符");1576 $(object).nextAll(".help-block").fadeTo(1,1);1577 }else{1578 $(object).parent('.input-group').nextAll(".help-block").text("请è¾å
¥"+min+"-"+max+"个å符");1579 $(object).parent('.input-group').nextAll(".help-block").fadeTo(1,1);1580 }1581 }else if(value.length<min){1582 $(object).parents(".form-group").addClass("has-error");1583 if($(object).nextAll(".help-block").length){1584 $(object).nextAll(".help-block").text("请è¾å
¥"+min+"-"+max+"个å符");1585 $(object).nextAll(".help-block").fadeTo(1,1);1586 }else{1587 $(object).parent('.input-group').nextAll(".help-block").text("请è¾å
¥"+min+"-"+max+"个å符");1588 $(object).parent('.input-group').nextAll(".help-block").fadeTo(1,1);1589 }1590 1591 }else if(!required){1592 $(object).parents(".form-group").removeClass("has-error").addClass("has-success");1593 if($(object).nextAll(".help-block").length){1594 $(object).nextAll(".help-block").fadeTo(1,0);1595 }else{1596 $(object).parent('.input-group').nextAll(".help-block").fadeTo(1,0);1597 }1598 }1599 }else{1600 $(object).parents(".form-group").removeClass("has-error").addClass("has-success");1601 if($(object).nextAll(".help-block").length){1602 $(object).nextAll(".help-block").fadeTo(1,0);1603 }else{1604 $(object).parent('.input-group').nextAll(".help-block").fadeTo(1,0);1605 }1606 }1607 }else if(checkType=='oldpwd'){1608 if(!value||value==''){1609 $(object).parents(".form-group").addClass("has-error");1610 if($(object).nextAll(".help-block").length){1611 $(object).nextAll(".help-block").text("请è¾å
¥æ°å¯ç ");1612 $(object).nextAll(".help-block").fadeTo(1,1);1613 }else{1614 $(object).parent('.input-group').nextAll(".help-block").text("请è¾å
¥æ°å¯ç ");1615 $(object).parent('.input-group').nextAll(".help-block").fadeTo(1,1);1616 }1617 }else if(max){1618 if(value.length>max){1619 $(object).parents(".form-group").addClass("has-error");1620 if($(object).nextAll(".help-block").length){1621 $(object).nextAll(".help-block").text("请è¾å
¥"+min+"-"+max+"个å符");1622 $(object).nextAll(".help-block").fadeTo(1,1);1623 }else{1624 $(object).parent('.input-group').nextAll(".help-block").text("请è¾å
¥"+min+"-"+max+"个å符");1625 $(object).parent('.input-group').nextAll(".help-block").fadeTo(1,1);1626 }1627 }else if(value.length<min){1628 $(object).parents(".form-group").addClass("has-error");1629 if($(object).nextAll(".help-block").length){1630 $(object).nextAll(".help-block").text("请è¾å
¥"+min+"-"+max+"个å符");1631 $(object).nextAll(".help-block").fadeTo(1,1);1632 }else{1633 $(object).parent('.input-group').nextAll(".help-block").text("请è¾å
¥"+min+"-"+max+"个å符");1634 $(object).parent('.input-group').nextAll(".help-block").fadeTo(1,1);1635 }1636 1637 }else if(!required){1638 $(object).parents(".form-group").removeClass("has-error").addClass("has-success");1639 if($(object).nextAll(".help-block").length){1640 $(object).nextAll(".help-block").fadeTo(1,0);1641 }else{1642 $(object).parent('.input-group').nextAll(".help-block").fadeTo(1,0);1643 }1644 }1645 }else{1646 $(object).parents(".form-group").removeClass("has-error").addClass("has-success");1647 if($(object).nextAll(".help-block").length){1648 $(object).nextAll(".help-block").fadeTo(1,0);1649 }else{1650 $(object).parent('.input-group').nextAll(".help-block").fadeTo(1,0);1651 }1652 }1653 }else if(checkType=='realname'){1654 if(!value||value==''){1655 $(object).parents(".form-group").addClass("has-error");1656 if($(object).nextAll(".help-block").length){1657 $(object).nextAll(".help-block").text("请æ¨è¾å
¥å§å");1658 $(object).nextAll(".help-block").fadeTo(1,1);1659 }else{1660 $(object).parent('.input-group').nextAll(".help-block").text("请æ¨è¾å
¥å§å");1661 $(object).parent('.input-group').nextAll(".help-block").fadeTo(1,1);1662 }1663 }else if(max){1664 if(value.length>max){1665 $(object).parents(".form-group").addClass("has-error");1666 if($(object).nextAll(".help-block").length){1667 $(object).nextAll(".help-block").text("请è¾å
¥"+min+"-"+max+"个å符");1668 $(object).nextAll(".help-block").fadeTo(1,1);1669 }else{1670 $(object).parent('.input-group').nextAll(".help-block").text("请è¾å
¥"+min+"-"+max+"个å符");1671 $(object).parent('.input-group').nextAll(".help-block").fadeTo(1,1);1672 }1673 }else if(value.length<min){1674 $(object).parents(".form-group").addClass("has-error");1675 if($(object).nextAll(".help-block").length){1676 $(object).nextAll(".help-block").text("请è¾å
¥"+min+"-"+max+"个å符");1677 $(object).nextAll(".help-block").fadeTo(1,1);1678 }else{1679 $(object).parent('.input-group').nextAll(".help-block").text("请è¾å
¥"+min+"-"+max+"个å符");1680 $(object).parent('.input-group').nextAll(".help-block").fadeTo(1,1);1681 }1682 1683 }else if(!required){1684 $(object).parents(".form-group").removeClass("has-error").addClass("has-success");1685 if($(object).nextAll(".help-block").length){1686 $(object).nextAll(".help-block").fadeTo(1,0);1687 }else{1688 $(object).parent('.input-group').nextAll(".help-block").fadeTo(1,0);1689 }1690 }1691 }else{1692 $(object).parents(".form-group").removeClass("has-error").addClass("has-success");1693 if($(object).nextAll(".help-block").length){1694 $(object).nextAll(".help-block").fadeTo(1,0);1695 }else{1696 $(object).parent('.input-group').nextAll(".help-block").fadeTo(1,0);1697 }1698 }1699 }else if(checkType=='news'){1700 if(!value||value==''){1701 $(object).parents(".form-group").addClass("has-error");1702 if($(object).nextAll(".help-block").length){1703 $(object).nextAll(".help-block").text("æ ç®å称ä¸è½ä¸ºç©ºï¼è¯·è¾å
¥æ ç®å称");1704 $(object).nextAll(".help-block").fadeTo(1,1);1705 }else{1706 $(object).parent('.input-group').nextAll(".help-block").text("æ ç®å称ä¸è½ä¸ºç©ºï¼è¯·è¾å
¥æ ç®å称");1707 $(object).parent('.input-group').nextAll(".help-block").fadeTo(1,1);1708 }1709 }else if(max){1710 if(value.length>max){1711 $(object).parents(".form-group").addClass("has-error");1712 if($(object).nextAll(".help-block").length){1713 $(object).nextAll(".help-block").text("请è¾å
¥"+min+"-"+max+"个å符");1714 $(object).nextAll(".help-block").fadeTo(1,1);1715 }else{1716 $(object).parent('.input-group').nextAll(".help-block").text("请è¾å
¥"+min+"-"+max+"个å符");1717 $(object).parent('.input-group').nextAll(".help-block").fadeTo(1,1);1718 }1719 }else if(value.length<min){1720 $(object).parents(".form-group").addClass("has-error");1721 if($(object).nextAll(".help-block").length){1722 $(object).nextAll(".help-block").text("请è¾å
¥"+min+"-"+max+"个å符");1723 $(object).nextAll(".help-block").fadeTo(1,1);1724 }else{1725 $(object).parent('.input-group').nextAll(".help-block").text("请è¾å
¥"+min+"-"+max+"个å符");1726 $(object).parent('.input-group').nextAll(".help-block").fadeTo(1,1);1727 }1728 1729 }else if(!required){1730 $(object).parents(".form-group").removeClass("has-error").addClass("has-success");1731 if($(object).nextAll(".help-block").length){1732 $(object).nextAll(".help-block").fadeTo(1,0);1733 }else{1734 $(object).parent('.input-group').nextAll(".help-block").fadeTo(1,0);1735 }1736 }1737 }else{1738 $(object).parents(".form-group").removeClass("has-error").addClass("has-success");1739 if($(object).nextAll(".help-block").length){1740 $(object).nextAll(".help-block").fadeTo(1,0);1741 }else{1742 $(object).parent('.input-group').nextAll(".help-block").fadeTo(1,0);1743 }1744 }1745 }else if(checkType=='sort'){1746 var myreg = /^\+?[1-9][0-9]*$/;1747 if(!myreg.test(value)&&value)1748 {1749 $(object).parents(".form-group").addClass("has-error");1750 if($(object).nextAll(".help-block").length){1751 $(object).nextAll(".help-block").text("请è¾å
¥æ£æ´æ°ï¼");1752 $(object).nextAll(".help-block").fadeTo(1,1);1753 }else{1754 $(object).parent('.input-group').nextAll(".help-block").text("请è¾å
¥æ£æ´æ°");1755 $(object).parent('.input-group').nextAll(".help-block").fadeTo(1,1);1756 }1757 }else if(!required){1758 $(object).parents(".form-group").removeClass("has-error").addClass("has-success");1759 if($(object).nextAll(".help-block").length){1760 $(object).nextAll(".help-block").fadeTo(1,0);1761 }else{1762 $(object).parent('.input-group').nextAll(".help-block").fadeTo(1,0);1763 }1764 }1765 if(!value||value==''){1766 $(object).parents(".form-group").addClass("has-error");1767 if($(object).nextAll(".help-block").length){1768 $(object).nextAll(".help-block").text("æåºå·ä¸è½ä¸ºç©ºï¼è¯·è¾å
¥æåºå·");1769 $(object).nextAll(".help-block").fadeTo(1,1);1770 }else{1771 $(object).parent('.input-group').nextAll(".help-block").text("æåºå·ä¸è½ä¸ºç©ºï¼è¯·è¾å
¥æåºå·");1772 $(object).parent('.input-group').nextAll(".help-block").fadeTo(1,1);1773 }1774 }else if(max){1775 if(value.length>max){1776 $(object).parents(".form-group").addClass("has-error");1777 if($(object).nextAll(".help-block").length){1778 $(object).nextAll(".help-block").text("请è¾å
¥"+min+"-"+max+"个å符");1779 $(object).nextAll(".help-block").fadeTo(1,1);1780 }else{1781 $(object).parent('.input-group').nextAll(".help-block").text("请è¾å
¥"+min+"-"+max+"个å符");1782 $(object).parent('.input-group').nextAll(".help-block").fadeTo(1,1);1783 }1784 }else if(value.length<min){1785 $(object).parents(".form-group").addClass("has-error");1786 if($(object).nextAll(".help-block").length){1787 $(object).nextAll(".help-block").text("请è¾å
¥"+min+"-"+max+"个å符");1788 $(object).nextAll(".help-block").fadeTo(1,1);1789 }else{1790 $(object).parent('.input-group').nextAll(".help-block").text("请è¾å
¥"+min+"-"+max+"个å符");1791 $(object).parent('.input-group').nextAll(".help-block").fadeTo(1,1);1792 }1793 1794 }else if(!required){1795 $(object).parents(".form-group").removeClass("has-error").addClass("has-success");1796 if($(object).nextAll(".help-block").length){1797 $(object).nextAll(".help-block").fadeTo(1,0);1798 }else{1799 $(object).parent('.input-group').nextAll(".help-block").fadeTo(1,0);1800 }1801 }1802 }else{1803 $(object).parents(".form-group").removeClass("has-error").addClass("has-success");1804 if($(object).nextAll(".help-block").length){1805 $(object).nextAll(".help-block").fadeTo(1,0);1806 }else{1807 $(object).parent('.input-group').nextAll(".help-block").fadeTo(1,0);1808 }1809 }1810 }else if(checkType=='loginname'){1811 var myreg =/^[a-zA-Z]{1}[0-9a-zA-Z_]{0,}$/;1812 if(!myreg.test(value)&&value)1813 {1814 $(object).parents(".form-group").addClass("has-error");1815 if($(object).nextAll(".help-block").length){1816 $(object).nextAll(".help-block").text("请è¾å
¥"+min+"-"+max+"个åæ¯ãæ°åæä¸å线ï¼ä¸è½ä»¥æ°ååä¸å线å¼å¤´");1817 $(object).nextAll(".help-block").fadeTo(1,1);1818 }else{1819 $(object).parent('.input-group').nextAll(".help-block").text("请è¾å
¥"+min+"-"+max+"个åæ¯ãæ°åæä¸å线ï¼ä¸è½ä»¥æ°ååä¸å线å¼å¤´");1820 $(object).parent('.input-group').nextAll(".help-block").fadeTo(1,1);1821 }1822 }else if(!required){1823 $(object).parents(".form-group").removeClass("has-error").addClass("has-success");1824 if($(object).nextAll(".help-block").length){1825 $(object).nextAll(".help-block").fadeTo(1,0);1826 }else{1827 $(object).parent('.input-group').nextAll(".help-block").fadeTo(1,0);1828 }1829 }1830 if(!value||value==''){1831 $(object).parents(".form-group").addClass("has-error");1832 if($(object).nextAll(".help-block").length){1833 $(object).nextAll(".help-block").text("ç¨æ·ç»å½åä¸è½ä¸ºç©ºï¼è¯·è¾å
¥");1834 $(object).nextAll(".help-block").fadeTo(1,1);1835 }else{1836 $(object).parent('.input-group').nextAll(".help-block").text("ç¨æ·ç»å½åä¸è½ä¸ºç©ºï¼è¯·è¾å
¥");1837 $(object).parent('.input-group').nextAll(".help-block").fadeTo(1,1);1838 }1839 }else if(max){1840 if(value.length>max){1841 $(object).parents(".form-group").addClass("has-error");1842 if($(object).nextAll(".help-block").length){1843 $(object).nextAll(".help-block").text("请è¾å
¥"+min+"-"+max+"个åæ¯ãæ°åæä¸å线ï¼ä¸è½ä»¥æ°ååä¸å线å¼å¤´");1844 $(object).nextAll(".help-block").fadeTo(1,1);1845 }else{1846 $(object).parent('.input-group').nextAll(".help-block").text("请è¾å
¥"+min+"-"+max+"个åæ¯ãæ°åæä¸å线ï¼ä¸è½ä»¥æ°ååä¸å线å¼å¤´");1847 $(object).parent('.input-group').nextAll(".help-block").fadeTo(1,1);1848 }1849 }else if(value.length<min){1850 $(object).parents(".form-group").addClass("has-error");1851 if($(object).nextAll(".help-block").length){1852 $(object).nextAll(".help-block").text("请è¾å
¥"+min+"-"+max+"个åæ¯ãæ°åæä¸å线ï¼ä¸è½ä»¥æ°ååä¸å线å¼å¤´");1853 $(object).nextAll(".help-block").fadeTo(1,1);1854 }else{1855 $(object).parent('.input-group').nextAll(".help-block").text("请è¾å
¥"+min+"-"+max+"个åæ¯ãæ°åæä¸å线ï¼ä¸è½ä»¥æ°ååä¸å线å¼å¤´");1856 $(object).parent('.input-group').nextAll(".help-block").fadeTo(1,1);1857 }1858 1859 }else if(!required){1860 $(object).parents(".form-group").removeClass("has-error").addClass("has-success");1861 if($(object).nextAll(".help-block").length){1862 $(object).nextAll(".help-block").fadeTo(1,0);1863 }else{1864 $(object).parent('.input-group').nextAll(".help-block").fadeTo(1,0);1865 }1866 }1867 }else{1868 $(object).parents(".form-group").removeClass("has-error").addClass("has-success");1869 if($(object).nextAll(".help-block").length){1870 $(object).nextAll(".help-block").fadeTo(1,0);1871 }else{1872 $(object).parent('.input-group').nextAll(".help-block").fadeTo(1,0);1873 }1874 }1875 }else if(checkType=='truename'){1876 if(!value||value==''){1877 $(object).parents(".form-group").addClass("has-error");1878 if($(object).nextAll(".help-block").length){1879 $(object).nextAll(".help-block").text("å§åä¸è½ä¸ºç©ºï¼è¯·è¾å
¥");1880 $(object).nextAll(".help-block").fadeTo(1,1);1881 }else{1882 $(object).parent('.input-group').nextAll(".help-block").text("å§åä¸è½ä¸ºç©ºï¼è¯·è¾å
¥");1883 $(object).parent('.input-group').nextAll(".help-block").fadeTo(1,1);1884 }1885 }else if(max){1886 if(value.length>max){1887 $(object).parents(".form-group").addClass("has-error");1888 if($(object).nextAll(".help-block").length){1889 $(object).nextAll(".help-block").text("请è¾å
¥"+min+"-"+max+"个å符");1890 $(object).nextAll(".help-block").fadeTo(1,1);1891 }else{1892 $(object).parent('.input-group').nextAll(".help-block").text("请è¾å
¥"+min+"-"+max+"个å符");1893 $(object).parent('.input-group').nextAll(".help-block").fadeTo(1,1);1894 }1895 }else if(value.length<min){1896 $(object).parents(".form-group").addClass("has-error");1897 if($(object).nextAll(".help-block").length){1898 $(object).nextAll(".help-block").text("请è¾å
¥"+min+"-"+max+"个å符");1899 $(object).nextAll(".help-block").fadeTo(1,1);1900 }else{1901 $(object).parent('.input-group').nextAll(".help-block").text("请è¾å
¥"+min+"-"+max+"个å符");1902 $(object).parent('.input-group').nextAll(".help-block").fadeTo(1,1);1903 }1904 1905 }else if(!required){1906 $(object).parents(".form-group").removeClass("has-error").addClass("has-success");1907 if($(object).nextAll(".help-block").length){1908 $(object).nextAll(".help-block").fadeTo(1,0);1909 }else{1910 $(object).parent('.input-group').nextAll(".help-block").fadeTo(1,0);1911 }1912 }1913 }else{1914 $(object).parents(".form-group").removeClass("has-error").addClass("has-success");1915 if($(object).nextAll(".help-block").length){1916 $(object).nextAll(".help-block").fadeTo(1,0);1917 }else{1918 $(object).parent('.input-group').nextAll(".help-block").fadeTo(1,0);1919 }1920 }1921 }else if(checkType=='groupname'){1922 if(!value||value==''){1923 $(object).parents(".form-group").addClass("has-error");1924 if($(object).nextAll(".help-block").length){1925 $(object).nextAll(".help-block").text("ç¨æ·ç»å称ä¸è½ä¸ºç©ºï¼è¯·è¾å
¥");1926 $(object).nextAll(".help-block").fadeTo(1,1);1927 }else{1928 $(object).parent('.input-group').nextAll(".help-block").text("ç¨æ·ç»å称ä¸è½ä¸ºç©ºï¼è¯·è¾å
¥");1929 $(object).parent('.input-group').nextAll(".help-block").fadeTo(1,1);1930 }1931 }else if(max){1932 if(value.length>max){1933 $(object).parents(".form-group").addClass("has-error");1934 if($(object).nextAll(".help-block").length){1935 $(object).nextAll(".help-block").text("请è¾å
¥"+min+"-"+max+"个å符");1936 $(object).nextAll(".help-block").fadeTo(1,1);1937 }else{1938 $(object).parent('.input-group').nextAll(".help-block").text("请è¾å
¥"+min+"-"+max+"个å符");1939 $(object).parent('.input-group').nextAll(".help-block").fadeTo(1,1);1940 }1941 }else if(value.length<min){1942 $(object).parents(".form-group").addClass("has-error");1943 if($(object).nextAll(".help-block").length){1944 $(object).nextAll(".help-block").text("请è¾å
¥"+min+"-"+max+"个å符");1945 $(object).nextAll(".help-block").fadeTo(1,1);1946 }else{1947 $(object).parent('.input-group').nextAll(".help-block").text("请è¾å
¥"+min+"-"+max+"个å符");1948 $(object).parent('.input-group').nextAll(".help-block").fadeTo(1,1);1949 }1950 1951 }else if(!required){1952 $(object).parents(".form-group").removeClass("has-error").addClass("has-success");1953 if($(object).nextAll(".help-block").length){1954 $(object).nextAll(".help-block").fadeTo(1,0);1955 }else{1956 $(object).parent('.input-group').nextAll(".help-block").fadeTo(1,0);1957 }1958 }1959 }else{1960 $(object).parents(".form-group").removeClass("has-error").addClass("has-success");1961 if($(object).nextAll(".help-block").length){1962 $(object).nextAll(".help-block").fadeTo(1,0);1963 }else{1964 $(object).parent('.input-group').nextAll(".help-block").fadeTo(1,0);1965 }1966 }1967 }else if(checkType=='size'){1968 var myreg = /^\+?[1-9][0-9]*$/;1969 if(!myreg.test(value)&&value)1970 {1971 $(object).parents(".form-group").addClass("has-error");1972 if($(object).nextAll(".help-block").length){1973 $(object).nextAll(".help-block").text("请è¾å
¥æ£æ´æ°ï¼");1974 $(object).nextAll(".help-block").fadeTo(1,1);1975 }else{1976 $(object).parent('.input-group').nextAll(".help-block").text("请è¾å
¥æ£æ´æ°");1977 $(object).parent('.input-group').nextAll(".help-block").fadeTo(1,1);1978 }1979 }else if(!required){1980 $(object).parents(".form-group").removeClass("has-error").addClass("has-success");1981 if($(object).nextAll(".help-block").length){1982 $(object).nextAll(".help-block").fadeTo(1,0);1983 }else{1984 $(object).parent('.input-group').nextAll(".help-block").fadeTo(1,0);1985 }1986 }1987 if(!value||value==''){1988 $(object).parents(".form-group").addClass("has-error");1989 if($(object).nextAll(".help-block").length){1990 $(object).nextAll(".help-block").text("空é´å¤§å°ä¸è½ä¸ºç©ºï¼è¯·è¾å
¥");1991 $(object).nextAll(".help-block").fadeTo(1,1);1992 }else{1993 $(object).parent('.input-group').nextAll(".help-block").text("空é´å¤§å°ä¸è½ä¸ºç©ºï¼è¯·è¾å
¥");1994 $(object).parent('.input-group').nextAll(".help-block").fadeTo(1,1);1995 }1996 }else if(max){1997 if(value.length>max){1998 $(object).parents(".form-group").addClass("has-error");1999 if($(object).nextAll(".help-block").length){2000 $(object).nextAll(".help-block").text("请è¾å
¥"+min+"-"+max+"个æ£æ´æ°");2001 $(object).nextAll(".help-block").fadeTo(1,1);2002 }else{2003 $(object).parent('.input-group').nextAll(".help-block").text("请è¾å
¥"+min+"-"+max+"个æ£æ´æ°");2004 $(object).parent('.input-group').nextAll(".help-block").fadeTo(1,1);2005 }2006 }else if(value.length<min){2007 $(object).parents(".form-group").addClass("has-error");2008 if($(object).nextAll(".help-block").length){2009 $(object).nextAll(".help-block").text("请è¾å
¥"+min+"-"+max+"个æ£æ´æ°");2010 $(object).nextAll(".help-block").fadeTo(1,1);2011 }else{2012 $(object).parent('.input-group').nextAll(".help-block").text("请è¾å
¥"+min+"-"+max+"个æ£æ´æ°");2013 $(object).parent('.input-group').nextAll(".help-block").fadeTo(1,1);2014 }2015 2016 }else if(!required){2017 $(object).parents(".form-group").removeClass("has-error").addClass("has-success");2018 if($(object).nextAll(".help-block").length){2019 $(object).nextAll(".help-block").fadeTo(1,0);2020 }else{2021 $(object).parent('.input-group').nextAll(".help-block").fadeTo(1,0);2022 }2023 }2024 }else{2025 $(object).parents(".form-group").removeClass("has-error").addClass("has-success");2026 if($(object).nextAll(".help-block").length){2027 $(object).nextAll(".help-block").fadeTo(1,0);2028 }else{2029 $(object).parent('.input-group').nextAll(".help-block").fadeTo(1,0);2030 }2031 }2032 }2033 }2034}2035//éªè¯åéæ¡2036function ridioCheck(obj){2037 if(($(obj).attr("required"))!=''){2038 if($(obj).find('input:radio[type="radio"]:checked').length==0){2039 $(obj).parents(".form-group").addClass("has-error");2040 $(obj).nextAll(".help-block").text("请éæ©ä¸é¡¹ï¼");2041 $(obj).nextAll(".help-block").fadeTo(1,1);2042 }else{2043 $(obj).parents(".form-group").removeClass("has-error").addClass("has-success");2044 $(obj).nextAll(".help-block").fadeTo(1,0); 2045 }2046 }2047}2048//éªè¯å¤éæ¡2049function checkboxCheck(obj){2050 if(($(obj).attr("required"))){2051 var min = $(obj).attr("min");2052 var max = $(obj).attr("max");2053 if($(obj).find('input:checkbox[type="checkbox"]:checked').length==0){2054 $(obj).parents(".form-group").addClass("has-error");2055 $(obj).nextAll(".help-block").text("请éæ©é项ï¼");2056 $(obj).nextAll(".help-block").fadeTo(1,1);2057 }else if(min&&$(obj).find('input:checkbox[type="checkbox"]:checked').length<min){2058 $(obj).parents(".form-group").addClass("has-error");2059 $(obj).nextAll(".help-block").text("请è³å°éæ©"+min+"项ï¼");2060 $(obj).nextAll(".help-block").fadeTo(1,1);2061 }else if(max&&$(obj).find('input:checkbox[type="checkbox"]:checked').length>max){2062 $(obj).parents(".form-group").addClass("has-error");2063 $(obj).nextAll(".help-block").text("请è³å¤éæ©"+max+"项ï¼");2064 $(obj).nextAll(".help-block").fadeTo(1,1);2065 }else{2066 $(obj).parents(".form-group").removeClass("has-error").addClass("has-success");2067 $(obj).nextAll(".help-block").fadeTo(1,0); 2068 }2069 }2070}...
biaodan.js
Source:biaodan.js
1 //---------------------éªè¯ææºå·------------------2 $(".zhengze").focus(function(){3 $(".zhengze").css({"border":"1px solid #6eb9e0","color":"#333"})4 $(".zhengze").nextAll(".z_shou").show().html("请è¾å
¥11ä½ææºå·").css("background","#ccc")5 $(".zhengze").nextAll(".z_dui").hide();6 $(".zhengze").nextAll(".z_cuo").hide();7 })8 9 function dd(){10 var reg = /^(13|15|18|17)\d{9}$/;11 //var reg=/^[\u4e00-\u9fa5]{4,6}$/;12 var str = $(".zhengze").val();13 //alert(str);14 if( !reg.test(str) ){15 if(str==""){16 $(".zhengze").nextAll(".z_shou").show().html("请è¾å
¥ææºå·").css("background","#ed787f")17 $(".zhengze").css("border","1px solid #f66")18 $(".zhengze").nextAll(".z_cuo").show();19 }else{20 $(".zhengze").nextAll(".z_shou").show().html("请è¾å
¥æ£ç¡®çææºå·ç ").css("background","#ed787f")21 $(".zhengze").css({"border":"1px solid #f66","color":"#333"})22 $(".zhengze").nextAll(".z_cuo").show();23 }24 return false;25 }else{26 $(".zhengze").nextAll(".z_dui").show();27 $(".zhengze").css("border","1px solid #dcdcdc")28 $(".zhengze").nextAll(".z_shou").hide()29 return true;30 }31 }32 33 //---------------------éªè¯éªè¯ç ------------------34 $(".yzm").focus(function(){35 $(".t_text5").css("border","1px solid #6eb9e0")36 $(".yzm").css("color","#333")37 $(".yzm").nextAll(".z_shou").hide()38 })39 40 function dd1(){41 var str = $(".yzm").val();42 var str1 = $(".yzm").nextAll(".yanz").html();43 if( str.toLowerCase()!= str1.toLowerCase()){44 if(str==""){45 $(".yzm").nextAll(".z_shou").show().html("请è¾å
¥éªè¯ç ").css("background","#ed787f")46 $(".t_text5").css("border","1px solid #dcdcdc")47 $(".yzm").css("border","0px solid #fff")48 }else{49 $(".yzm").nextAll(".z_shou").show().html("éªè¯æ误").css("background","#ed787f")50 $(".yzm").css({"border":"1px solid #f66","height":32+"px","width":138+"px"})51 $(".t_text5").css("border","1px solid #dcdcdc")52 }53 return false;54 }else{55 $(".yzm").nextAll(".z_shou").hide()56 $(".yzm").css("border","0px solid #fff")57 $(".t_text5").css("border","1px solid #dcdcdc")58 return true;59 }60 }61 62 //-------------------ç»éªè¯ç 设置å
容------------------------63 $(function(){64 yanzhenma();65 })66 $(".shuan").click(function(){67 //alert(11);68 yanzhenma();69 }); 70 //è·åå个éæºæ° ä½ä¸ºéªè¯ç 71 function yanzhenma(){72 var arr = [];//åæ¾éæºå符73 for(var i=0;i<4;i++){74 //éæºäº§çä¸ä¸ª 48--122ä¹é´çunicodeå¼75 var asc = Math.floor( Math.random()*(122-48+1) +48 );76 while( asc>57&&asc<65 || asc>90&&asc<97 ){77 asc = Math.floor( Math.random()*(122-48+1) +48 );//å¦æååºæ¥ä¸æ»¡è¶³æ¡ä»¶ åæ¯ãæ°åï¼éæ°éæºåå¼78 }79 arr[i] = String.fromCharCode( asc ); 80 }81 $(".yanz").html( arr.join('') );82 }83 84 85 //------------æ ¡éªç ---------------86 $(".jym").focus(function(){87 $(".jym").css({"border":"1px solid #6eb9e0","color":"#333"})88 $(".jym").nextAll(".z_cuo1").hide();89 $(".jym").nextAll(".z_shou1").hide();90 })91 function dd2(){92 var reg=/^\d{6}$/;93 var str=$(".jym").val();94 if(str==''){95 $(".jym").nextAll(".z_shou1").show().html("请è¾å
¥æ ¡éªç ").css("background","#ed787f")96 $(".jym").css("border","1px solid #f66")97 $(".jym").nextAll(".z_cuo1").show();98 return false;99 }else{100 if(!reg.test(str)){101 $(".jym").nextAll(".z_shou1").show().html("éªè¯ç è¾å
¥æ误").css("background","#ed787f")102 $(".jym").css("border","1px solid #f66")103 }else{104 $(".jym").css("border","1px solid #dcdcdc")105 }106 return false;107 }108 }109 110 //------------ç¹å»è·åéªè¯ç ---------------111 $(".huoqu").click(function(){112 var str = $(".yzm").val();113 var str1 = $(".yzm").nextAll(".yanz").html();114 if(str.toLowerCase()!= str1.toLowerCase()){115 if(str==""){116 $(".yzm").nextAll(".z_shou").show().html("éªè¯ç 为空").css("background","#ed787f")117 $(".t_text5").css("border","1px solid #dcdcdc")118 $(".yzm").css("border","0px solid #fff")119 }else{120 $(".yzm").nextAll(".z_shou").show().html("éªè¯æ误").css("background","#ed787f")121 $(".yzm").css({"border":"1px solid #f66","height":32+"px","width":138+"px"})122 $(".t_text5").css("border","1px solid #dcdcdc")123 }124 return false;125 }else{126 var reg = /^(13|15|18|17)\d{9}$/;127 var str = $(".zhengze").val();128 if( !reg.test(str) ){129 if(str==""){130 $(".zhengze").nextAll(".z_shou").show().html("请è¾å
¥ææºå·").css("background","#ed787f")131 $(".zhengze").css("border","1px solid #f66")132 $(".zhengze").nextAll(".z_cuo").show();133 }else{134 $(".zhengze").nextAll(".z_shou").show().html("请è¾å
¥æ£ç¡®çææºå·ç ").css("background","#ed787f")135 $(".zhengze").css("border","1px solid #f66")136 $(".zhengze").nextAll(".z_cuo").show();137 }138 return false;139 }else{140 var i=60;141 var timer=setInterval(function(){142 $(".huoqu").val(i+"ç§åéæ°è·å").css("color","#ccc");143 i--;144 if(i==0){145 clearInterval(timer);146 $(".huoqu").removeAttr('disabled');147 $(".huoqu").val("è·åçä¿¡æ ¡éªç ").css("color","#666");148 } 149 },1000);150 $(this).attr('disabled','disabled');151 return true;152 } 153 }154 })155 156 //------------设置å¯ç ---------------157 158 $(".pwd").focus(function(){159 $(".pwd").css({"border":"1px solid #6eb9e0","color":"#333"})160 $(".pwd").nextAll(".z_shou").show().html("8-20ä½å符ï¼æ°åãåæ¯ã符å·è³å°å
å«ä¸¤ç§").css("background","#ccc")161 $(".pwd").nextAll(".z_dui").hide();162 $(".pwd").nextAll(".z_cuo").hide();163 })164 165 function dd3(){166 //var reg = /$/;167 var shu =/(?!^[0-9]+$)(?!^[A-z]+$)(?!^[^A-z0-9]+$)^.{6,16}/;168 var str = $(".pwd").val();169 //alert(str);170 if(!shu.test(str)){171 $(".pwd").nextAll(".z_shou").show().html("æ°åãåæ¯ã符å·è³å°å
å«ä¸¤ç§").css("background","#ed787f")172 if(str.length<8){173 $(".pwd").nextAll(".z_shou").show().html("å¯ç é¿åº¦ä¸º8-20ä½").css("background","#ed787f")174 $(".pwd").css({"border":"1px solid #f66","color":"#333"})175 $(".pwd").nextAll(".z_cuo").show();176 if(str==""){177 $(".pwd").nextAll(".z_shou").show().html("请è¾å
¥å¯ç ").css("background","#ed787f")178 $(".pwd").css("border","1px solid #f66")179 $(".pwd").nextAll(".z_cuo").show();180 }181 }182 return false;183 }else{184 $(".pwd").nextAll(".z_dui").show();185 $(".pwd").css("border","1px solid #dcdcdc")186 $(".pwd").nextAll(".z_shou").hide()187 return true;188 }189 }190 191 $(".pwd1").focus(function(){192 $(".pwd1").css({"border":"1px solid #6eb9e0","color":"#333"})193 $(".pwd1").nextAll(".z_shou").hide()194 $(".pwd1").nextAll(".z_dui").hide();195 $(".pwd1").nextAll(".z_cuo").hide();196 })197 function dd4(){198 var str = $(".pwd").val();199 var str1 = $(".pwd1").val();200 if(str1==""){201 $(".pwd1").nextAll(".z_shou").show().html("请å次è¾å
¥å¯ç ").css("background","#ed787f")202 $(".pwd1").css("border","1px solid #f66")203 $(".pwd1").nextAll(".z_cuo").show();204 return false;205 }else{206 if(str1!=str){207 $(".pwd1").nextAll(".z_shou").show().html("两次è¾å
¥å¯ç ä¸ä¸è´").css("background","#ed787f")208 $(".pwd1").css("border","1px solid #f66")209 $(".pwd1").nextAll(".z_cuo").show();210 return false;211 }else{212 $(".pwd1").nextAll(".z_dui").show();213 $(".pwd1").css("border","1px solid #dcdcdc")214 $(".pwd1").nextAll(".z_shou").hide()215 return true;216 }217 218 }219 }220 221 function dd5(){222 if(!$(".dxu").prop("checked")){223 $(".dxu").parent().parent().find("p").show()224 return false;225 }else{226 $(".dxu").parent().parent().find("p").hide()227 return true;228 }229 }230 231 $(".a_deng").click(function(){232 if($(".zhengze").val()==""){233 $(".zhengze").nextAll(".z_shou").show().html("请è¾å
¥ææºå·").css("background","#ed787f")234 $(".zhengze").css("border","1px solid #f66")235 $(".zhengze").nextAll(".z_cuo").show();236 }else if($(".yzm").val()==""){237 $(".yzm").nextAll(".z_shou").show().html("请è¾å
¥éªè¯ç ").css("background","#ed787f")238 $(".t_text5").css("border","1px solid #dcdcdc")239 $(".yzm").css("border","0px solid #fff")240 }else if($(".jym").val()==""){241 $(".jym").nextAll(".z_shou1").show().html("请è¾å
¥æ ¡éªç ").css("background","#ed787f")242 $(".jym").css("border","1px solid #f66")243 $(".jym").nextAll(".z_cuo1").show();244 }else if($(".pwd").val()==""){245 $(".pwd").nextAll(".z_shou").show().html("请è¾å
¥å¯ç ").css("background","#ed787f")246 $(".pwd").css("border","1px solid #f66")247 $(".pwd").nextAll(".z_cuo").show();248 }else if($(".pwd1").val()==""){249 $(".pwd1").nextAll(".z_shou").show().html("请å次è¾å
¥å¯ç ").css("background","#ed787f")250 $(".pwd1").css("border","1px solid #f66")251 $(".pwd1").nextAll(".z_cuo").show();252 }else if(!$(".dxu").prop("checked")){253 $(".dxu").parent().parent().find("p").show()254 }else{255 var name=$(".zhengze").val(); 256 var pwd=$(".pwd").val();257 d={258 "uname":name,259 "upwd":pwd260 }261 var flag=true;262 var arr=[]263 var oldarr1=getCookie("sname")264 if(oldarr1.length!=0){265 arr=oldarr1266 for(var i=0;i<arr.length;i++){267 if(d.uname==arr[i].uname){268 alert("该ææºå·å·²è¢«æ³¨å")269 flag=false;270 return;271 //ç´æ¥return è¿å272 }273 }274 }275 276 if(flag){277 arr.push(d)278 }279 setCookie("sname",JSON.stringify(arr),5)280 alert("注åæå")281 }282 283 284 })285//------------------------------------é®ç®±æ³¨å-------------------------------286//-----------é®ç®±å¯ç éªè¯-----------287$(".pwd2").focus(function(){288 $(".pwd2").css({"border":"1px solid #6eb9e0","color":"#333"})289 $(".pwd2").nextAll(".z_shou").show().html("8-20ä½å符ï¼æ°åãåæ¯ã符å·è³å°å
å«ä¸¤ç§").css("background","#ccc")290 $(".pwd2").nextAll(".z_dui").hide();291 $(".pwd2").nextAll(".z_cuo").hide();292 })293 294 function dd6(){295 //var reg = /$/;296 var shu =/(?!^[0-9]+$)(?!^[A-z]+$)(?!^[^A-z0-9]+$)^.{6,16}/;297 var str = $(".pwd2").val();298 //alert(str);299 if(!shu.test(str)){300 $(".pwd2").nextAll(".z_shou").show().html("æ°åãåæ¯ã符å·è³å°å
å«ä¸¤ç§").css("background","#ed787f")301 if(str.length<8){302 $(".pwd2").nextAll(".z_shou").show().html("å¯ç é¿åº¦ä¸º8-20ä½").css("background","#ed787f")303 $(".pwd2").css({"border":"1px solid #f66","color":"#333"})304 $(".pwd2").nextAll(".z_cuo").show();305 if(str==""){306 $(".pwd2").nextAll(".z_shou").show().html("请è¾å
¥å¯ç ").css("background","#ed787f")307 $(".pwd2").css("border","1px solid #f66")308 $(".pwd2").nextAll(".z_cuo").show();309 }310 }311 return false;312 }else{313 $(".pwd2").nextAll(".z_dui").show();314 $(".pwd2").css("border","1px solid #dcdcdc")315 $(".pwd2").nextAll(".z_shou").hide()316 return true;317 }318 }319 320 $(".pwd3").focus(function(){321 $(".pwd3").css({"border":"1px solid #6eb9e0","color":"#333"})322 $(".pwd3").nextAll(".z_shou").hide()323 $(".pwd3").nextAll(".z_dui").hide();324 $(".pwd3").nextAll(".z_cuo").hide();325 })326 function dd7(){327 var str = $(".pwd2").val();328 var str1 = $(".pwd3").val();329 if(str1==""){330 $(".pwd3").nextAll(".z_shou").show().html("请å次è¾å
¥å¯ç ").css("background","#ed787f")331 $(".pwd3").css("border","1px solid #f66")332 $(".pwd3").nextAll(".z_cuo").show();333 return false;334 }else{335 if(str1!=str){336 $(".pwd3").nextAll(".z_shou").show().html("两次è¾å
¥å¯ç ä¸ä¸è´").css("background","#ed787f")337 $(".pwd3").css("border","1px solid #f66")338 $(".pwd3").nextAll(".z_cuo").show();339 return false;340 }else{341 $(".pwd3").nextAll(".z_dui").show();342 $(".pwd3").css("border","1px solid #dcdcdc")343 $(".pwd3").nextAll(".z_shou").hide()344 return true;345 }346 347 }348 }349//---------------------é®ç®±éªè¯------------------350 $(".yx").focus(function(){351 $(".yx").css({"border":"1px solid #6eb9e0","color":"#333"})352 $(".yx").nextAll(".z_shou").show().html("请è¾å
¥é®ç®±").css("background","#ccc")353 $(".yx").nextAll(".z_dui").hide();354 $(".yx").nextAll(".z_cuo").hide();355 })356 357 function dd10(){358 var reg = /^\d{5,10}(@qq\.com)|(@163\.com)$/;359 var str = $(".yx").val();360 //alert(str);361 if( !reg.test(str) ){362 if(str==""){363 $(".yx").nextAll(".z_shou").show().html("请è¾å
¥é®ç®±").css("background","#ed787f")364 $(".yx").css("border","1px solid #f66")365 $(".yx").nextAll(".z_cuo").show();366 }else{367 $(".yx").nextAll(".z_shou").show().html("请è¾å
¥æ£ç¡®çé®ç®±").css("background","#ed787f")368 $(".yx").css("border","1px solid #f66")369 $(".yx").nextAll(".z_cuo").show();370 }371 return false;372 }else{373 $(".yx").nextAll(".z_dui").show();374 $(".yx").css("border","1px solid #dcdcdc")375 $(".yx").nextAll(".z_shou").hide()376 return true;377 }378 }379//---------------------ç¨æ·å------------------380 $(".yhm").focus(function(){381 $(".yhm").css({"border":"1px solid #6eb9e0","color":"#333"})382 $(".yhm").nextAll(".z_shou").show().html("请è¾å
¥ç¨æ·å").css("background","#ccc")383 $(".yhm").nextAll(".z_dui").hide();384 $(".yhm").nextAll(".z_cuo").hide();385 })386 387 function dd13(){388 var reg = /^\D.{4,20}/;389 var str = $(".yhm").val();390 //alert(str);391 if( !reg.test(str) ){392 if(str==""){393 $(".yhm").nextAll(".z_shou").show().html("请è¾å
¥ç¨æ·å").css("background","#ed787f")394 $(".yhm").css("border","1px solid #f66")395 $(".yhm").nextAll(".z_cuo").show();396 }else{397 $(".yhm").nextAll(".z_shou").show().html("ç¨æ·å4-20ä½ï¼åæ¯ãæ°åã-ã_ç»æï¼éæ°åå¼å¤´").css("background","#ed787f")398 $(".yhm").css("border","1px solid #f66")399 $(".yhm").nextAll(".z_cuo").show();400 }401 return false;402 }else{403 $(".yhm").nextAll(".z_dui").show();404 $(".yhm").css("border","1px solid #dcdcdc")405 $(".yhm").nextAll(".z_shou").hide()406 return true;407 }408 }409 410 //---------------------éªè¯éªè¯ç ------------------411 $(".yzm1").focus(function(){412 $(".t_text5").css("border","1px solid #6eb9e0")413 $(".yzm1").css("color","#333")414 $(".yzm1").nextAll(".z_shou").hide()415 })416 417 function dd9(){418 var str = $(".yzm1").val();419 var str1 = $(".yzm1").nextAll(".yanz1").html();420 if( str.toLowerCase()!= str1.toLowerCase()){421 if(str==""){422 $(".yzm1").nextAll(".z_shou").show().html("请è¾å
¥éªè¯ç ").css("background","#ed787f")423 $(".t_text5").css("border","1px solid #dcdcdc")424 $(".yzm1").css("border","0px solid #fff")425 }else{426 $(".yzm1").nextAll(".z_shou").show().html("éªè¯æ误").css("background","#ed787f")427 $(".yzm1").css({"border":"1px solid #f66","height":32+"px","width":138+"px"})428 $(".t_text5").css("border","1px solid #dcdcdc")429 }430 return false;431 }else{432 $(".yzm1").nextAll(".z_shou").hide()433 $(".yzm1").css("border","0px solid #fff")434 $(".t_text5").css("border","1px solid #dcdcdc")435 return true;436 }437 }438 439 //-------------------ç»éªè¯ç 设置å
容------------------------440 $(function(){441 yanzhenma1();442 })443 $(".shuan1").click(function(){444 //alert(11);445 yanzhenma1();446 }); 447 //è·åå个éæºæ° ä½ä¸ºéªè¯ç 448 function yanzhenma1(){449 var arr = [];//åæ¾éæºå符450 for(var i=0;i<4;i++){451 //éæºäº§çä¸ä¸ª 48--122ä¹é´çunicodeå¼452 var asc = Math.floor( Math.random()*(122-48+1) +48 );453 while( asc>57&&asc<65 || asc>90&&asc<97 ){454 asc = Math.floor( Math.random()*(122-48+1) +48 );//å¦æååºæ¥ä¸æ»¡è¶³æ¡ä»¶ åæ¯ãæ°åï¼éæ°éæºåå¼455 }456 arr[i] = String.fromCharCode( asc ); 457 }458 $(".yanz1").html( arr.join('') );459 }460 461 462 //-------------------æå·²é
读并åæ------------------------463 function dd12(){464 if(!$(".dxu1").prop("checked")){465 $(".dxu1").parent().parent().find("p").show()466 return false;467 }else{468 $(".dxu1").parent().parent().find("p").hide()469 return true;470 }471 }472 473 474 //var d1={};475 $(".a_deng1").click(function(){476 if($(".yx").val()==""){477 $(".yx").nextAll(".z_shou").show().html("请è¾å
¥é®ç®±").css("background","#ed787f")478 $(".yx").css("border","1px solid #f66")479 $(".yx").nextAll(".z_cuo").show();480 }else if($(".yhm").val()==""){481 $(".yhm").nextAll(".z_shou").show().html("请è¾å
¥ç¨æ·å").css("background","#ed787f")482 $(".yhm").css("border","1px solid #f66")483 $(".yhm").nextAll(".z_cuo").show();484 }else if($(".pwd2").val()==""){485 $(".pwd2").nextAll(".z_shou").show().html("请è¾å
¥å¯ç ").css("background","#ed787f")486 $(".pwd2").css("border","1px solid #f66")487 $(".pwd2").nextAll(".z_cuo").show();488 }else if($(".pwd3").val()==""){489 $(".pwd3").nextAll(".z_shou").show().html("请å次è¾å
¥å¯ç ").css("background","#ed787f")490 $(".pwd3").css("border","1px solid #f66")491 $(".pwd3").nextAll(".z_cuo").show();492 }else if($(".yzm1").val()==""){493 $(".yzm1").nextAll(".z_shou").show().html("请è¾å
¥éªè¯ç ").css("background","#ed787f")494 $(".t_text5").css("border","1px solid #dcdcdc")495 $(".yzm1").css("border","0px solid #fff")496 }else if(!$(".dxu1").prop("checked")){497 $(".dxu1").parent().parent().find("p").show()498 }else{499 var yyx=$(".yx").val();500 var yname=$(".yhm").val(); 501 var ypwd=$(".pwd2").val();502 d1={503 "yuyx":yyx,504 "yuname":yname,505 "yupwd":ypwd506 }507 var flag=true;508 var arr1=[]509 var oldarr=getCookie("ynames")510 if(oldarr.length!=0){511 arr1=oldarr512 for(var i=0;i<arr1.length;i++){513 if(d1.yuname==arr1[i].yuname||d1.yuyx==arr1[i].yuyx){514 alert("该ç¨æ·å·²è¢«æ³¨å")515 flag=false;516 return;517 //ç´æ¥return è¿å518 }519 }520 }521 522 if(flag){523 arr1.push(d1)524 }525 setCookie("ynames",JSON.stringify(arr1),5)526 alert("注åæå")527 }528 529 530 })531 532 533 534 $(".zh").focus(function(){535 $(".zh").css("border","1px solid #6eb9e0")536 $(".zh").css("color","#333")537 $(".zh").nextAll(".z_shou").hide()538 $(".zh").nextAll(".z_cuo").hide();539 })540 541 function dd8(){542 var str=$(".zh").val();543 if(str==""){544 $(".zh").nextAll(".z_shou").show().html("请è¾å
¥ç¨æ·å/é®ç®±/ææºå·").css("background","#ed787f")545 $(".zh").css("border","1px solid #f66")546 $(".zh").nextAll(".z_cuo").show();547 }else{548 $(".zh").css("border","1px solid #dcdcdc")549 $(".zh").nextAll(".z_cuo").hide();550 }551 552 }553 554 $(".mima").focus(function(){555 $(".mima").css("border","1px solid #6eb9e0")556 $(".mima").css("color","#333")557 $(".mima").nextAll(".z_shou").hide()558 $(".mima").nextAll(".z_cuo").hide();559 })560 561 function dd11(){562 var str=$(".mima").val();563 if(str==""){564 $(".mima").nextAll(".z_shou").show().html("请è¾å
¥å¯ç ").css("background","#ed787f")565 $(".mima").css("border","1px solid #f66")566 $(".mima").nextAll(".z_cuo").show();567 }else{568 $(".mima").css("border","1px solid #dcdcdc")569 $(".mima").nextAll(".z_cuo").hide();570 }571 }572 573 574 //---------------------éªè¯éªè¯ç ------------------575 $(".dyzm").focus(function(){576 $(".t_text5").css("border","1px solid #6eb9e0")577 $(".dyzm").css("color","#333")578 $(".dyzm").nextAll(".z_shou").hide()579 })580 581 function dd14(){582 var str = $(".dyzm").val();583 var str1 = $(".dyzm").nextAll(".dyanz").html();584 if( str.toLowerCase()!= str1.toLowerCase()){585 if(str==""){586 $(".dyzm").nextAll(".z_shou").show().html("请è¾å
¥éªè¯ç ").css("background","#ed787f")587 $(".t_text5").css("border","1px solid #f66")588 $(".dyzm").css("border","0px solid #fff")589 }else{590 $(".dyzm").nextAll(".z_shou").show().html("éªè¯æ误").css("background","#ed787f")591 //$(".dyzm").css({"border":"1px solid #f66","height":32+"px","width":138+"px"})592 $(".t_text5").css("border","1px solid #f66")593 }594 return false;595 }else{596 $(".dyzm").nextAll(".z_shou").hide()597 $(".dyzm").css("border","0px solid #fff")598 $(".t_text5").css("border","1px solid #dcdcdc")599 return true;600 }601 }602 603 //-------------------ç»éªè¯ç 设置å
容------------------------604 $(function(){605 yanzhenma2();606 })607 $(".dshuan").click(function(){608 //alert(11);609 yanzhenma2();610 }); 611 //è·åå个éæºæ° ä½ä¸ºéªè¯ç 612 function yanzhenma2(){613 var arr = [];//åæ¾éæºå符614 for(var i=0;i<4;i++){615 //éæºäº§çä¸ä¸ª 48--122ä¹é´çunicodeå¼616 var asc = Math.floor( Math.random()*(122-48+1) +48 );617 while( asc>57&&asc<65 || asc>90&&asc<97 ){618 asc = Math.floor( Math.random()*(122-48+1) +48 );//å¦æååºæ¥ä¸æ»¡è¶³æ¡ä»¶ åæ¯ãæ°åï¼éæ°éæºåå¼619 }620 arr[i] = String.fromCharCode( asc ); 621 }622 $(".dyanz").html( arr.join('') );623 }624 625 626 //if(tc.name){627 //$(".huang").find("span").html("hiï¼"+tc.name)628 //$(".tuichu").click(function(){629 // removeCookie("Intuichu")630 //})631 //location.reload()632 //}633 634 $(".d_coo").click(function(){635 if($(".zh").val()==""){636 $(".zh").nextAll(".z_shou").show().html("请è¾å
¥ç¨æ·å/é®ç®±/ææºå·").css("background","#ed787f")637 $(".zh").css("border","1px solid #f66")638 $(".zh").nextAll(".z_cuo").show();639 }else if($(".mima").val()==""){640 $(".mima").nextAll(".z_shou").show().html("请è¾å
¥å¯ç ").css("background","#ed787f")641 $(".mima").css("border","1px solid #f66")642 $(".mima").nextAll(".z_cuo").show();643 }else if($(".dyzm").val()==""){644 $(".dyzm").nextAll(".z_shou").show().html("éªè¯ç 为空").css("background","#ed787f")645 $(".t_text5").css("border","1px solid #f66")646 $(".dyzm").css("border","0px solid #fff")647 }else{648 var cookieInfo = getCookie("ynames");//youx649 var cookieInfo1 = getCookie("sname");650 //var cookieInfo1 = getCookie("sname");//shouji651 var name = $(".zh").val();652 var pwd = $(".mima").val();653 var flag1=true;654 655 for(var i=0;i<cookieInfo.length;i++){656 if(name==cookieInfo[i].yuname&&pwd==cookieInfo[i].yupwd&&$(".dyzm").val().toLowerCase()==$(".dyanz").html().toLowerCase()){657 flag1=false;658 //$(".huang").find("span").html("hiï¼"+name)659 $(".tc1,.zhezhao").css("display","none");660 var j = {"name":cookieInfo[i].yuname}661 //$(".xiaoxi,.tuichu").show();662 663 location.reload()664 setCookie("yonghuming",JSON.stringify(j),0)665 //setCookie("yonghuming",cookieInfo[i].yuname,0)666 //éæ°è®¾ç½®ä¸ä¸ªcookie æ¹ä¾¿ä¸æ¬¡å
ç»é667 //setCookie("Intuichu",JSON.stringify(cookieInfo[i]),5)668 669 }670 671 }672 673 /*for(var k=0;k<cookieInfo1.length;k++){674 if(name==cookieInfo1[k].yuname&&pwd==cookieInfo1[i].yupwd&&$(".dyzm").val().toLowerCase()==$(".dyanz").html().toLowerCase()){675 flag1=false;676 //$(".huang").find("span").html("hiï¼"+name)677 $(".tc1,.zhezhao").css("display","none");678 var j = {"name":cookieInfo1[k].yuname}679 //$(".xiaoxi,.tuichu").show();680 681 //location.reload()682 setCookie("yonghuming",JSON.stringify(j),0)683 //setCookie("yonghuming",cookieInfo[i].yuname,0)684 //éæ°è®¾ç½®ä¸ä¸ªcookie æ¹ä¾¿ä¸æ¬¡å
ç»é685 //setCookie("Intuichu",JSON.stringify(cookieInfo[i]),5)686 687 }688 689 }*/690 691 if(flag1){692 alert("è´¦æ·åæå¯ç é误ï¼è¯·éæ°è¾å
¥")693 }694 695 }696 })697 698 $(".tuichu").click(function(){699 location.reload()700 removeCookie("yonghuming");701 $(".huang span").html("欢è¿æ¥é
ä»ç½ï¼");702 $(".xiaoxi,.tuichu").css("display","none");703 //$(".xiaoxi,.tuichu").show();704 })...
enroll.js
Source:enroll.js
1$(".field.floating input").each(function (i, elem) {2 if ($(elem).val()) {3 $(elem).next("label").addClass("hasvalue")4 }5})6// input placeholder ä½ç½®7$(".field.floating input").blur(function () {8 //console.log(1)9 var $input = $(this);10 if ($input.val()) {11 //console.log(2)12 $input.next("label").addClass("hasvalue")13 } else {14 $input.next("label").removeClass("hasvalue")15 }16})17// ---------------------注åçé¢js18// ç¸å
³æ¡æ¬¾ä¸æé19$("a.show-message").click(function () {20 $("div.clause-box").toggleClass("show-y");21 $(this).toggleClass("open");22})23// ç¨æ·å24$("#uname").focus(function () {25 $(this).nextAll(".message").removeClass("my-opacity err").html("ç¨æ·å为6-21ä½çåæ¯ãæ°åãä¸å线ç»æ").nextAll(".input-after").addClass(26 "my-d-none");27}).blur(function () {28 if ($(this).val()) {29 var reg = /^\w{6,21}$/;30 var ures = reg.test($(this).val())31 if (ures) {32 //console.log("åé请æ±éªè¯ç¨æ·å");33 $.ajax({34 url: "http://localhost:3000/enroll",35 type: "get",36 data: {37 uname: $("#uname").val()38 },39 // crossDomain: true,40 // xhrFields: {41 // withCredentials: true42 // },43 dataType: "json"44 }).then(function (res) {45 //console.log(res)46 if (res.length !== 0) {47 //console.log("å¦æç¨æ·åéå¤") 48 $("#uname").nextAll(".message").addClass("err").html("ç¨æ·åå·²å ç¨").nextAll(".input-after").addClass("my-d-none");49 } else {50 //console.log("å¯ä»¥")51 $("#uname").nextAll(".message").addClass("my-opacity").nextAll(".input-after").removeClass(52 "my-d-none")53 }54 })55 } else {56 $(this).nextAll(".message").addClass("err").nextAll(".input-after").addClass("my-d-none");57 }58 } else {59 //console.log($(this).html())60 $(this).nextAll(".message").addClass("err").html("ç¨æ·åä¸å¯ä¸ºç©º").nextAll(".input-after").addClass(61 "my-d-none");62 }63})64//å¯ç æ¡65$("#upwd").focus(function () {66 var $upwd = $(this);67 $upwd.nextAll(".input-after").addClass("my-d-none");68 $(".toggle-password").removeClass("mright");69 $upwd.nextAll(".message-do").removeClass("my-height0 my-d-none");70 $upwd.nextAll(".message").addClass("my-d-none");71 var sreg = /^\w*$/;72 if (sreg.test($upwd.val())) {73 $("#message-do-1").addClass("succeed")74 } else {75 $("#message-do-1").removeClass("succeed")76 };77 var lreg = /^.{6,16}$/;78 if (lreg.test($upwd.val())) {79 $("#message-do-2").addClass("succeed")80 } else {81 $("#message-do-2").removeClass("succeed")82 };83 var breg = /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)[^]*$/;84 if (breg.test($upwd.val())) {85 $("#message-do-3").addClass("succeed")86 } else {87 $("#message-do-3").removeClass("succeed")88 };89}).blur(function () {90 var $upwd = $(this);91 $upwd.nextAll(".message-do").addClass("my-d-none");92 if ($upwd.val()) {93 var childs = $upwd.nextAll(".message-do").children();94 //console.log(childs)95 for (var i = 0; i < 3; i++) {96 if (!$(childs[i]).hasClass("succeed")) {97 var msg = $(childs[i]).html();98 $upwd.nextAll(".input-after").addClass("my-d-none");99 $upwd.nextAll(".message").removeClass("my-d-none my-opacity").addClass("err").html(msg);100 $(".toggle-password").removeClass("mright");101 break;102 } else {103 $upwd.nextAll(".input-after").removeClass("my-d-none");104 $(".toggle-password").addClass("mright");105 }106 }107 } else {108 $upwd.nextAll(".input-after").addClass("my-d-none");109 $upwd.nextAll(".message").removeClass("my-d-none my-opacity").addClass("err").html("å¯ç ä¸å¯ä¸ºç©º")110 .nextAll(".input-after").addClass("my-d-none");111 }112}).on("input propertychange", function () {113 var $upwd = $(this);114 var sreg = /^\w*$/;115 if (sreg.test($upwd.val())) {116 $("#message-do-1").addClass("succeed")117 } else {118 $("#message-do-1").removeClass("succeed")119 };120 var lreg = /^.{6,16}$/;121 if (lreg.test($upwd.val())) {122 $("#message-do-2").addClass("succeed")123 } else {124 $("#message-do-2").removeClass("succeed")125 };126 var breg = /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)[^]*$/;127 if (breg.test($upwd.val())) {128 $("#message-do-3").addClass("succeed")129 } else {130 $("#message-do-3").removeClass("succeed")131 };132})133// å¯ç çå°ç¼ç134$(".toggle-password").mousedown(function () {135 $(this).removeClass("hide").addClass("show");136 $("#upwd").attr("type", "text");137});138$(".toggle-password").on("mouseup mouseleave", function () {139 $("#upwd").attr("type", "password");140 $(this).removeClass("show").addClass("hide")141})142// é®ç®±143$("#email").focus(function () {144 $(this).nextAll(".message").removeClass("my-opacity err").html("请è¾å
¥ææé®ç®±å°å")145}).blur(function () {146 if ($(this).val()) {147 var reg = /^[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$/;148 var res = reg.test($(this).val())149 if (res) {150 $(this).nextAll(".message").addClass("my-opacity").nextAll(".input-after").removeClass(151 "my-d-none")152 } else {153 $(this).nextAll(".message").addClass("err").nextAll(".input-after").addClass("my-d-none");154 }155 } else {156 //console.log($(this).html())157 $(this).nextAll(".message").addClass("err").html("é®ç®±ä¸å¯ä¸ºç©º").nextAll(".input-after").addClass(158 "my-d-none");159 }160})161// ææºå·162$("#phone").focus(function () {163 $(this).nextAll(".message").removeClass("my-opacity err").html("请è¾å
¥ææææºå·ç ");164 $(".wrapper.wrapper-auth").removeClass("my-d-none");165 if (!$("#sendauth").is(":disabled")) {166 $("#sendauth").removeClass("disabled");167 }168}).blur(function () {169 if ($(this).val()) {170 var reg = /^1[3456789]\d{9}$/;171 var res = reg.test($(this).val())172 if (res) {173 $(this).nextAll(".message").addClass("my-opacity").nextAll(".input-after").removeClass(174 "my-d-none");175 } else {176 $(this).nextAll(".message").addClass("err").nextAll(".input-after").addClass("my-d-none");177 $("#sendauth").addClass("disabled");178 }179 } else {180 $("#sendauth").addClass("disabled");181 $(this).nextAll(".message").addClass("err").html("ææºå·ä¸å¯ä¸ºç©º").nextAll(".input-after").addClass(182 "my-d-none");183 }184})185// çä¿¡éªè¯ç 186$("#auth").focus(function () {187 $(this).nextAll(".message").removeClass("my-opacity err").html("请è¾å
¥6ä½éªè¯ç ");188 $(".wrapper.wrapper-auth").removeClass("my-d-none");189}).blur(function () {190 if ($(this).val()) {191 if ($(this).val() == "123456") {192 $(this).nextAll(".message").addClass("my-opacity");193 } else {194 $(this).nextAll(".message").addClass("err").html("éªè¯ç ä¸æ£ç¡®");195 }196 } else {197 $(this).nextAll(".message").addClass("err").html("éªè¯ç ä¸å¯ä¸ºç©º").nextAll(".input-after").addClass(198 "my-d-none");199 }200})201// æ交æé®çæ ·å¼202$("#reg-remember").change(function () {203 if ($(this).is(":checked")) {204 $("#submituser").removeClass("disabled");205 } else {206 $("#submituser").addClass("disabled");207 }208})209// ç»æ交æé®ç»å®æ交äºä»¶210$("#submituser").click(function () {211 if (212 $("div.input-after").hasClass("my-d-none") || $("#auth").val() !== "123456" || !$(213 "#reg-remember").is(":checked")214 ) {215 $(".field.floating input").each(function (i, elem) {216 if ($(elem).val() == "") {217 $(elem).nextAll(".message").addClass("err").removeClass("my-opacity")218 }219 })220 return;221 } else {222 //console.log("åé请æ±");223 $.ajax({224 url: "http://localhost:3000/enroll",225 type: "post",226 data: {227 'uname': $("#uname").val(),228 'upwd': $("#upwd").val(),229 'email': $("#email").val(),230 'phone': $("#phone").val()231 },232 // crossDomain: true,233 // xhrFields: {234 // withCredentials: true235 // },236 dataType: "json"237 }).then(function (res) {238 if (res.affectedRows !== 0) {239 $("#msg-box").removeClass("my-opacity")240 sessionStorage.setItem("uid", res.insertId);241 sessionStorage.setItem("uname", $("#uname").val());242 sessionStorage.setItem("start", 0);243 setTimeout(function () {244 location.replace("/account.html")245 }, 1500)246 }247 //console.log(res);248 })249 }250})251// éªè¯ç æé®æ ·å¼252$("#sendauth").click(function () {253 var $sendauth = $(this);254 if ($("#phone").nextAll(".input-after").hasClass("my-d-none")) {255 $("#sendauth").addClass("disabled");256 return;257 } else {258 var time = 60;259 $sendauth.addClass("disabled").attr('disabled', "true").html(60);260 var t = setInterval(function () {261 time -= 1;262 $sendauth.html(time);263 if (time == 0) {264 $sendauth.removeClass("disabled").removeAttr("disabled").html("åéçä¿¡éªè¯ç ")265 clearInterval(t);266 }267 }, 1000)268 }...
address.js
Source:address.js
1/**2 * Created by Charles on 2014/6/30.3 */4$(function(){5 var hostUrl = "http://" + window.location.host;6 $(".submitAddress").click(function(){7 var receiverName = $("#receiverName");8 var state = $("#state");9 var city = $("#city");10 var street = $("#street");11 var zipCode = $("#zipCode");12 var mobile = $("#mobile");13 var zipPhone = $("#zipPhone");14 var phone = $("#phone");15 var childPhone = $("#childPhone");16 var defaultAddress = $("#defaultAdd");17 var addressId = $("#newAddressId").val();18 if(state.val() == "" || state.val() == null || state.val() == "请éæ©"){19 receiverName.nextAll(".msg-error").html("<i class='error-icon'></i>请éæ©ç份");20 receiverName.nextAll(".msg-error").removeClass("Hide");21 return false;22 }23 if(city.val() == "" || city.val() == null || city.val() == "请éæ©"){24 receiverName.nextAll(".msg-error").html("<i class='error-icon'></i>请éæ©åå¸");25 receiverName.nextAll(".msg-error").removeClass("Hide");26 return false;27 }28 if(receiverName.val() == "" || receiverName.val() == null || CheckLength(receiverName.val())>20){29 alert("请æ£ç¡®å¡«åæ¶è´§äººå称");30 return false;31 }32 if(street.val() == "" || street.val() == null || CheckLength(street.val())>100){33 alert("请æ£ç¡®å¡«å详ç»å°å");34 return false;35 }36 if(zipCode.val() == "" || zipCode.val() == null || CheckLength(zipCode.val())>10 || !/^[0-9]*$/.test(zipCode.val())){37 alert("请æ£ç¡®å¡«åé®æ¿ç¼ç ");38 return false;39 }40 if(mobile.val() =="" && zipPhone.val() == "" && phone.val() ==""){41 alert("ææºå·ååºå®çµè¯è³å°å¡«åä¸é¡¹");42 return false;43 }44 if(CheckLength(mobile.val())!=11 || !/^[0-9]*$/.test(mobile.val())){45 alert("请æ£ç¡®å¡«åææºå·ç ");46 return false;47 }48 if(CheckLength(zipPhone.val())>4 || !/^[0-9]*$/.test(zipPhone.val())){49 alert("请æ£ç¡®å¡«åçµè¯å·ç ");50 return false;51 }52 if(CheckLength(phone.val())>8 || !/^[0-9]*$/.test(phone.val())){53 alert("请æ£ç¡®å¡«åçµè¯å·ç ");54 return false;55 }56 $.ajax({57 method: "POST",58 url: hostUrl+"/buyerCenter/saveAddress",59 data: {60 addressId : addressId,61 receiverName:receiverName.val(),62 state:state.val(),63 city:city.val(),64 street:street.val(),65 zipCode:zipCode.val(),66 mobile:mobile.val(),67 zipPhone:zipPhone.val(),68 phone:phone.val(),69 childPhone:childPhone.val(),70 defaultAddress:defaultAddress.val()71 },72 success: function (data) {73 $('.new-address').css('display','none');74 $('.fixed').css('display','none');75 $(".address-list").html(data);76 $("#newAddressId").val("");77 receiverName.val("");78 state.val("");79 city.val("");80 street.val("");81 zipCode.val("");82 mobile.val("");83 zipPhone.val("");84 phone.val("");85 childPhone.val("");86 defaultAddress.val("0");87 defaultAddress.removeAttr("checked");88 }89 });90 });91 $(".addressSubmit").click(function(){92 var receiverName = $("#receiverName");93 var state = $("#state");94 var city = $("#city");95 var street = $("#street");96 var zipCode = $("#zipCode");97 var mobile = $("#mobile");98 var zipPhone = $("#zipPhone");99 var phone = $("#phone");100 var childPhone = $("#childPhone");101 var defaultAddress = $("#defaultAddress1");102 var addressId = $("#id");103 if(state.val() == "" || state.val() == null || state.val() == "请éæ©"){104 state.nextAll(".msg-error").html("<i class='error-icon'></i>请éæ©ç份");105 state.nextAll(".msg-error").removeClass("Hide");106 return false;107 }108 if(city.val() == "" || city.val() == null || city.val() == "请éæ©"){109 city.nextAll(".msg-error").html("<i class='error-icon'></i>请éæ©åå¸");110 city.nextAll(".msg-error").removeClass("Hide");111 return false;112 }113 if(receiverName.val() == "" || receiverName.val() == null || CheckLength(receiverName.val())>20){114 receiverName.nextAll(".msg-error").html("<i class='error-icon'></i>请æ£ç¡®å¡«åæ¶è´§äººå称");115 receiverName.nextAll(".msg-error").removeClass("Hide");116 return false;117 }118 if(street.val() == "" || street.val() == null || CheckLength(street.val())>100){119 street.nextAll(".msg-error").html("<i class='error-icon'></i>请æ£ç¡®å¡«å详ç»å°å");120 street.nextAll(".msg-error").removeClass("Hide");121 return false;122 }123 if(zipCode.val() == "" || zipCode.val() == null || CheckLength(zipCode.val())>10 || !/^[0-9]*$/.test(zipCode.val())){124 zipCode.nextAll(".msg-error").html("<i class='error-icon'></i>请æ£ç¡®å¡«åé®æ¿ç¼ç ");125 zipCode.nextAll(".msg-error").removeClass("Hide");126 return false;127 }128 if((mobile.val()) =="" && zipPhone.val() == "" && phone.val() ==""){129 mobile.nextAll(".msg-error").html("<i class='error-icon'></i>ææºå·ååºå®çµè¯è³å°å¡«åä¸é¡¹");130 mobile.nextAll(".msg-error").removeClass("Hide");131 return false;132 }133 if(mobile.val() !="" || (zipPhone.val() != "" && phone.val() !="")){134 if((CheckLength(mobile.val()) !=11 || !/^[0-9]*$/.test(mobile.val())) && zipPhone.val() == "" && phone.val() ==""){135 mobile.nextAll(".msg-error").html("<i class='error-icon'></i>请æ£ç¡®å¡«åææºå·ç ");136 mobile.nextAll(".msg-error").removeClass("Hide");137 return false;138 }139 if( (CheckLength(zipPhone.val())>4 || !/^[0-9]*$/.test(zipPhone.val())) && mobile.val() ==""){140 zipPhone.nextAll(".msg-error").html("<i class='error-icon'></i>请æ£ç¡®å¡«åçµè¯å·ç ");141 zipPhone.nextAll(".msg-error").removeClass("Hide");142 return false;143 }144 if((CheckLength(phone.val())>8 || !/^[0-9]*$/.test(phone.val())) && mobile.val() ==""){145 phone.nextAll(".msg-error").html("<i class='error-icon'></i>请æ£ç¡®å¡«åçµè¯å·ç ");146 phone.nextAll(".msg-error").removeClass("Hide");147 return false;148 }149 if(CheckLength(childPhone.val())>4 || !/^[0-9]*$/.test(childPhone.val())){150 childPhone.nextAll(".msg-error").html("<i class='error-icon'></i>请æ£ç¡®å¡«åçµè¯å·ç ");151 childPhone.nextAll(".msg-error").removeClass("Hide");152 return false;153 }154 }155 $("#address").submit();156 });157 $("#defaultAddress1").change(function(){158 if($(this).val()==0){159 $(this).attr("checked","checked");160 $(this).val("1");161 }else if($(this).val()==1){162 $(this).val("0");163 $(this).removeAttr("checked");164 }165 });166 $(".addInfoVali").blur(function(){167 var target = $(this);168 if(target.val() == "" || target.val() == null){169 target.nextAll(".msg-error").removeClass("Hide");170 }else{171 target.nextAll(".msg-error").addClass("Hide");172 }173 });174 $(".deleteAddress").click(function () {175 var addId = $(this).attr("data-id");176 if(confirm("æ¯å¦å é¤æ¤å°åï¼")){177 $.ajax({178 method: "GET",179 url: hostUrl + "/buyerCenter/address/delete/"+addId,180 success: function (data) {181 $(".tbl-deliver-address").html(data);182 }183 });184 }185 });186 //订å确认页é¢è®¾ç½®é»è®¤å°å187 $('.defaultAddress').click(function () {188 var addressId = $(this).attr("data-id");189 if (addressId == null || addressId == "") {190 return false;191 } else {192 $.ajax({193 url: hostUrl + "/buyerCenter/defaultAddress/"+addressId,194 method: 'get',195 success: function (data) {196 $(".tbl-deliver-address").html(data);197 }198 });199 }200 });201});202function CheckLength(strTemp) {203 var i,sum;204 sum=0;205 for(i=0;i<strTemp.length;i++) {206 if ((strTemp.charCodeAt(i)>=0) && (strTemp.charCodeAt(i)<=255)) {207 sum=sum+1;208 }else {209 sum=sum+2;210 }211 }212 return sum;...
register.js
Source:register.js
1$(function(){2 /*å¼å
¥å
Œ
±å¤´é¨*/3 $(".header").load("base.html .register-header");4 /*å¼å
¥å
Œ
±åºé¨*/5 $("#bottom").load("base.html #bottom");6 /*ç¹å»åæ¢æ³¨åæ¹å¼*/7 $(".tabs li").click(function(){8 $(".tabs li").removeClass("active");9 $(this).addClass("active");10 $("form").children().css("display","none")11 $("form").children().eq($(this).index()).css("display","block");12 })13 /*ææºæ³¨åéªè¯*/14 //å¾å½¢éªè¯ç éªè¯15 yzm();16 //ç¹å»åæ¢éªè¯ç 17 18 $("#chyzm").click(function(){19 yzm();20 })21 $("#chyzm1").click(function(){22 yzm();23 })24 //ææºå·éªè¯25 function end(){26 if($("#phone").css("display")=="block"){27 if(!$("#phone .input-phone").val()){28 $("#phone .input-phone").nextAll("span").removeClass();29 $("#phone .input-phone").nextAll("span").css("class","info");30 $("#phone .input-phone").nextAll("span").addClass("pass-tip");31 $("#phone .input-phone").nextAll("span").html("<i></i>"+"ææºå·ä¸è½ä¸ºç©º");32 return;33 }else{34 $("#phone .input-phone").nextAll("span").removeClass();35 $("#phone .input-phone").nextAll("span").html("");36 }37 }else{38 if(!$(".input-email").val()){39 $(".input-email").nextAll("span").removeClass();40 $(".input-email").nextAll("span").css("class","info");41 $(".input-email").nextAll("span").addClass("pass-tip");42 $(".input-email").nextAll("span").html("<i></i>"+"é®ç®±ä¸è½ä¸ºç©º");43 return;44 }else{45 $(".input-email").nextAll("span").removeClass();46 $(".input-email").nextAll("span").html("");47 }48 }49 }50 $("#phone .input-phone").blur(phReg);51 function phReg() {52 console.log($(this));53 end();54 if($(this).nextAll("span").text()){55 return;56 }57 var phValue = $(this).val();58 var reg = /^[1][13578]\d{9}$/;59 var check = reg.test(phValue);60 if (check == true) {61 var yzmValue = $("#verficode").val();62 var yzmValue1 = $("#phone .yzm").text();63 if(yzmValue==""){64 $(this).nextAll("span").addClass("pass-error");65 $(this).nextAll("span").html("<i></i>"+"请è¾å
¥å¾å½¢éªè¯ç ");66 return;67 }68 if(yzmValue1.toLowerCase() !=yzmValue.toLowerCase()){69 $(this).nextAll("span").addClass("pass-error");70 $(this).nextAll("span").html("<i></i>"+"å¾å½¢éªè¯ç é误");71 return;72 }73 if($(this).val()==$.cookie($(this).val())){74 $(this).nextAll("span").addClass("pass-error");75 $(this).nextAll("span").html("<i></i>"+"ææºå·å·²ç»åå¨");76 return;77 }78 $(this).nextAll("span").addClass("pass-succ");79 $(this).nextAll("span").html("<i></i>");80 }else{81 $(this).nextAll("span").addClass("pass-error");82 $(this).nextAll("span").html("<i></i>"+"ææºå·æ ¼å¼ä¸æ£ç¡®");83 }84 }85 //è·åéªè¯ç 86 $("#Phone_SendCode").click(getYzm);87 function getYzm(){88 $(this).prev().val(random(6));89 $(this).nextAll("span").removeClass();90 $(this).nextAll("span").css("class","info");91 $(this).nextAll("span").addClass("pass-succ");92 $(this).nextAll("span").html("<i></i>");93 }94 $("#Phone_SendCode1").click(getYzm);95 $(".input-yzm").blur(function(){96 if(!$(this).val()){97 $(this).nextAll("span").removeClass();98 $(this).nextAll("span").css("class","info");99 $(this).nextAll("span").addClass("pass-tip");100 $(this).nextAll("span").html("<i></i>"+"éªè¯ç ä¸è½ä¸ºç©º");101 return;102 }103 })104 //设置éªè¯å¯ç 105 $("#Phone_ConfimPassword").blur(function(){106 if(!$("#Phone_Password").val()){107 $(this).nextAll("span").removeClass();108 $(this).nextAll("span").css("class","info");109 $(this).nextAll("span").addClass("pass-tip");110 $(this).nextAll("span").html("<i></i>"+"å¯ç ä¸è½ä¸ºç©º");111 return;112 }113 if($(this).val()==$("#Phone_Password").val()){114 var pwd = $("#Phone_Password").val().split("");115 if(pwd.length<6){116 $(this).nextAll("span").removeClass();117 $(this).nextAll("span").css("class","info");118 $(this).nextAll("span").addClass("pass-error");119 $(this).nextAll("span").html("<i></i>"+"å¯ç ä¸è½å°äº6ä½");120 }else{121 $(this).nextAll("span").removeClass();122 $(this).nextAll("span").css("class","info");123 $(this).nextAll("span").addClass("pass-succ"); 124 $(this).nextAll("span").html("<i></i>");125 }126 }else{127 var pwd = $("#Phone_Password").val().split("");128 if(pwd.length<6){129 $(this).nextAll("span").removeClass();130 $(this).nextAll("span").css("class","info");131 $(this).nextAll("span").addClass("pass-error");132 $(this).nextAll("span").html("<i></i>"+"å¯ç ä¸è½å°äº6ä½");133 }else{134 $(this).nextAll("span").removeClass();135 $(this).nextAll("span").css("class","info");136 $(this).nextAll("span").addClass("pass-error");137 $(this).nextAll("span").html("<i></i>"+"两次å¯ç ä¸ä¸è´");138 }139 }140 })141 /*é®ç®±ç»å½*/142 //é®ç®±éªè¯143 $(".input-email").blur(emReg);144 function emReg() {145 end();146 if($(this).nextAll("span").text()){147 return;148 }149 var reg = /^\w+@\w+(\.\w+)+$/;150 var check = reg.test($(this).val());151 if (check == true) {152 if($(this).val()==$.cookie($(this).val())){153 $(this).nextAll("span").addClass("pass-error");154 $(this).nextAll("span").html("<i></i>"+"é®ç®±å·²ç»åå¨");155 return;156 }157 $(this).nextAll("span").addClass("pass-succ");158 $(this).nextAll("span").html("<i></i>");159 return;160 }else{161 $(this).nextAll("span").addClass("pass-error");162 $(this).nextAll("span").html("<i></i>"+"é®ç®±æ ¼å¼ä¸æ£ç¡®");163 }164 }165 166 //é®ç®±ç»éææºéªè¯167 $("#email .input-phone").blur(function () {168 if(!$(this).val()){169 $(this).nextAll("span").removeClass();170 $(this).nextAll("span").css("class","info");171 $(this).nextAll("span").addClass("pass-tip");172 $(this).nextAll("span").html("<i></i>"+"ææºå·ä¸è½ä¸ºç©º");173 return;174 }175 var phValue = $(this).val();176 var reg = /^[1][13578]\d{9}$/;177 var check = reg.test(phValue);178 if (check == true) {179 var yzmValue = $("#email #verficode").val();180 var yzmValue1 = $("#email .yzm").text();181 if(yzmValue==""){182 $(this).nextAll("span").addClass("pass-error");183 $(this).nextAll("span").html("<i></i>"+"请è¾å
¥å¾å½¢éªè¯ç ");184 return;185 }186 if(yzmValue1.toLowerCase() !=yzmValue.toLowerCase()){187 $(this).nextAll("span").addClass("pass-error");188 $(this).nextAll("span").html("<i></i>"+"å¾å½¢éªè¯ç é误");189 return;190 }191 $(this).nextAll("span").addClass("pass-succ");192 $(this).nextAll("span").html("<i></i>");193 }else{194 $(this).nextAll("span").addClass("pass-error");195 $(this).nextAll("span").html("<i></i>"+"ææºå·æ ¼å¼ä¸æ£ç¡®");196 }197 })198199 /*注å*/200 $(".register").click(function(){201 //ææºæ³¨åç¶æä¸202 if($("#phone").css("display")=="block"){203 $.proxy(phReg, $("#phone .input-phone"))();204 }else{205 //é®ç®±æ³¨åç¶æä¸206 $.proxy(emReg, $(".input-email"))();207 }208 if($("span").hasClass("pass-error")||$("span").hasClass("pass-tip")){209 return;210 }211 if($("#phone").css("display")=="block"){212 var tmpJSON = {213 name:$('.input-phone').val(),214 pwd:$('.input-key').val()215 };216 var tmpStr = JSON.stringify(tmpJSON);217 $.cookie($('.input-phone').val(),tmpStr,{expires:30,path:'/'});218 }else{219 //é®ç®±æ³¨åç¶æä¸220 var tmpJSON = {221 name:$('.input-email').val(),222 pwd:$('.input-key').val()223 };224 var tmpStr = JSON.stringify(tmpJSON);225 $.cookie($('.input-email').val(),tmpStr,{expires:30,path:'/'});226 }227 location.href = "http://127.0.0.1:8020/ygw/register-succ.html";228 229 })230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260
...
form.js
Source:form.js
1$(function(){2 $('#participation input').change(function(){3 $(this).parent().parent().parent().nextAll('#private_car_flag').removeClass('required');4 $(this).parent().parent().parent().nextAll('#private_car_flag').find('input').removeClass("validate[required]");5 $(this).parent().parent().parent().nextAll('#private_car').removeClass('required');6 $(this).parent().parent().parent().nextAll('#private_car').find('input').removeClass("validate[required]");7 $(this).parent().parent().parent().nextAll('#car_rental').removeClass('required');8 $(this).parent().parent().parent().nextAll('#car_rental').find('input').removeClass("validate[required]");9 $(this).parent().parent().parent().nextAll('#racket').removeClass('required');10 $(this).parent().parent().parent().nextAll('#racket').find('input').removeClass("validate[required]");11 $(this).parent().parent().parent().nextAll('#ball').removeClass('required');12 $(this).parent().parent().parent().nextAll('#ball').find('input').removeClass("validate[required]");13 $(this).parent().parent().parent().nextAll('#date').removeClass('required');14 $(this).parent().parent().parent().nextAll('#date').find('input').removeClass("validate[required]");15 $(this).parent().parent().parent().nextAll('#note').removeClass('required');16 $(this).parent().parent().parent().nextAll('#note').find('textarea').removeClass("validate[required]");17 $(this).parent().parent().parent().nextAll('#note').removeClass('free');18 $(this).parent().parent().parent().nextAll('#note').removeClass('absent');19 $(this).parent().parent().parent().nextAll('#note').removeClass('undecided');20 if($(this).val()=="1"){21 $(this).parent().parent().parent().nextAll('#private_car_flag').addClass('required');22 $(this).parent().parent().parent().nextAll('#private_car_flag').find('input').addClass("validate[required]");23 $(this).parent().parent().parent().nextAll('#racket').addClass('required');24 $(this).parent().parent().parent().nextAll('#racket').find('input').addClass("validate[required]");25 $(this).parent().parent().parent().nextAll('#ball').addClass('required');26 $(this).parent().parent().parent().nextAll('#ball').find('input').addClass("validate[required]");27 $(this).parent().parent().parent().nextAll('#note').addClass('free');28 if($("#private_car_flag input:checked").val()=="1"){29 $(this).parent().parent().parent().nextAll('#private_car').addClass('required');30 $(this).parent().parent().parent().nextAll('#private_car').find('input').addClass("validate[required]");31 }else if($("#private_car_flag input:checked").val()=="0"){32 $(this).parent().parent().parent().nextAll('#car_rental').addClass('required');33 $(this).parent().parent().parent().nextAll('#car_rental').find('input').addClass("validate[required]");34 }35 }else if($(this).val()=="2"){36 $(this).parent().parent().parent().nextAll('#date').addClass('required');37 $(this).parent().parent().parent().nextAll('#date').find('input').addClass("validate[required]");38 $(this).parent().parent().parent().nextAll('#note').addClass('free');39 }else if($(this).val()=="3"){40 $(this).parent().parent().parent().nextAll('#note').addClass('required');41 $(this).parent().parent().parent().nextAll('#note').find('textarea').addClass("validate[required]");42 $(this).parent().parent().parent().nextAll('#note').addClass('absent');43 }else{44 $(this).parent().parent().parent().nextAll('#note').addClass('required');45 $(this).parent().parent().parent().nextAll('#note').find('textarea').addClass("validate[required]");46 $(this).parent().parent().parent().nextAll('#note').addClass('undecided');47 }48 });49 $('#private_car_flag input').change(function(){50 $(this).parent().parent().parent().nextAll('#private_car').removeClass('required');51 $(this).parent().parent().parent().nextAll('#private_car').find('input').removeClass("validate[required]");52 $(this).parent().parent().parent().nextAll('#car_rental').removeClass('required');53 $(this).parent().parent().parent().nextAll('#car_rental').find('input').removeClass("validate[required]");54 if($(this).val()=="1"){55 $(this).parent().parent().parent().nextAll('#private_car').addClass('required');56 $(this).parent().parent().parent().nextAll('#private_car').find('input').addClass("validate[required]");57 }else{58 $(this).parent().parent().parent().nextAll('#car_rental').addClass('required');59 $(this).parent().parent().parent().nextAll('#car_rental').find('input').addClass("validate[required]");60 }61 });...
G.nextAll.test.js
Source:G.nextAll.test.js
1const $ = require('../index');2const config = require('./config');3const jc1 = require('./code/simple1');4const jc2 = require('./code/simple2');5const hc1 = require('./code/simple1.html');6test('$.nextAll: empty code', () => {7 expect(()=>{8 const G = $('');9 G.nextAll();10 }).not.toThrow();11})12test('$.nextAll: simple code', () => {13 expect(()=>{14 const G = $('var a = 1;');15 G.nextAll();16 }).not.toThrow();17})18test('$.nextAll: this[0] is null', () => {19 expect(()=>{20 const G = $('var a = 1;');21 G[0] = null22 G.nextAll();23 }).not.toThrow();24})25test('$.nextAll: simple code 2', () => {26 expect(() => {27 const code = `28 function test(){29 let a = 1;30 let b = 2;31 }32 test();33 `34 const G = $(code)35 const ss = G.nextAll()36 }).not.toThrow()37})38test('$.nextAll: simple code 3', () => {39 expect(() => {40 const code = `41 let obj = { a: 1, b: 2 };42 let c = obj.a + obj.b;43 `44 const G = $(code)45 const ss = G.nextAll()46 }).not.toThrow()47})48test('$.nextAll: simple code 4', () => {49 expect(() => {50 const code = `51 function parent(){52 let name = 'jerry';53 function eat(){54 console.log('do eat');55 }56 }57 parent();58 `59 const G = $(code).find('let $_$ = \'$_$\'');60 const ss = G.nextAll()61 }).not.toThrow()62})63test('$.nextAll: simple code 4', () => {64 const code = `65 function parent(){66 let name = 'jerry';67 function eat(){68 console.log('do eat');69 }70 }71 parent();72 `73 const G = $(code).find('let $_$ = \'$_$\'');74 const result = G.nextAll().generate()75 const compareCode = $(`function eat(){76 console.log('do eat');77}`).generate();78// commentï¼å¯ä»¥èèå»ææ¢è¡ç¬¦åç©ºæ ¼ä¹ååå对æ¯ï¼ä¸ç¶ä»£ç 缩è¿ä¼å½±åç»æ79 expect(result).toBe(compareCode);80})81test('$.nextAll: simple html code', () => {82 const code = `<div>test</div>`;83 expect(() => {84 const G = $(code, config.html);85 G.nextAll();86 }).not.toThrow();87})88test('$.nextAll: simple html code', () => {89 const code = `<div>90 <span>test</span>91 <a href="xxx">is a link</a>92 </div>`;93 expect(() => {94 const G = $(code, config.html).find('<span>$_$</span>');95 G.nextAll();96 }).not.toThrow();97})98test('$.nextAll: simple html code result should be ok', () => {99 const code = `<div>100 <span>test</span>101 <a href="xxx">is a link</a>102 </div>`;103 const G = $(code, config.html).find('<span>$_$</span>');104 const result = G.nextAll().generate();105 expect(result).toBe(`\n `);...
Using AI Code Generation
1describe('Cypress', () => {2 it('is working', () => {3 expect(true).to.equal(true)4 })5 it('visits the kitchen sink', () => {6 cy.contains('type').click()7 cy.url().should('include', '/commands/actions')8 cy.get('.action-email')9 .nextAll()10 .should('have.class', 'action-disabled')11 })12})13describe('Cypress', () => {14 it('is working', () => {15 expect(true).to.equal(true)16 })17 it('visits the kitchen sink', () => {18 cy.contains('type').click()19 cy.url().should('include', '/commands/actions')20 cy.get('.action-email')21 .nextAll()22 .should('have.class', 'action-disabled')23 })24})25describe('Cypress', () => {26 it('is working', () => {27 expect(true).to.equal(true)28 })29 it('visits the kitchen sink', () => {30 cy.contains('type').click()31 cy.url().should('include', '/commands/actions')32 cy.get('.action-email')33 .nextAll()34 .should('have.class', 'action-disabled')35 })36})37describe('Cypress', () => {38 it('is working', () => {39 expect(true).to.equal(true)40 })41 it('visits the kitchen sink', () => {42 cy.contains('type').click()43 cy.url().should('include', '/commands/actions')44 cy.get('.action-email')45 .nextAll()46 .should('have.class', 'action-disabled')47 })48})49describe('Cypress', () => {50 it('is working', () => {51 expect(true).to.equal(true)52 })
Using AI Code Generation
1Cypress.Commands.add('nextAll', { prevSubject: 'element' }, (subject) => {2 return cy.wrap(subject).nextAll()3})4Cypress.Commands.add('parent', { prevSubject: 'element' }, (subject) => {5 return cy.wrap(subject).parent()6})7Cypress.Commands.add('invoke', { prevSubject: 'element' }, (subject) => {8 return cy.wrap(subject).invoke()9})10Cypress.Commands.add('children', { prevSubject: 'element' }, (subject) => {11 return cy.wrap(subject).children()12})13Cypress.Commands.add('closest', { prevSubject: 'element' }, (subject) => {14 return cy.wrap(subject).closest()15})16Cypress.Commands.add('first', { prevSubject: 'element' }, (subject) => {17 return cy.wrap(subject).first()18})19Cypress.Commands.add('last', { prevSubject: 'element' }, (subject) => {20 return cy.wrap(subject).last()21})22Cypress.Commands.add('parents', { prevSubject: 'element' }, (subject) => {23 return cy.wrap(subject).parents()24})25Cypress.Commands.add('prev', { prevSubject: 'element' }, (subject) => {26 return cy.wrap(subject).prev()27})28Cypress.Commands.add('prevAll', { prevSubject: 'element' }, (subject) => {29 return cy.wrap(subject).prevAll()30})31Cypress.Commands.add('siblings', { prevSubject: 'element' }, (subject) => {32 return cy.wrap(subject).siblings()33})34Cypress.Commands.add('parent', { prevSubject: 'element' }, (subject) => {35 return cy.wrap(subject).parent()36})37Cypress.Commands.add('eq', { prevSubject: 'element' }, (subject) => {38 return cy.wrap(subject).eq()39})
Using AI Code Generation
1Cypress.Commands.add("nextall", {prevSubject: 'element'}, (subject, selector) => {2 const siblings = [];3 let next = subject.next();4 while (next.length) {5 if (next.is(selector)) {6 siblings.push(next.get(0));7 }8 next = next.next();9 }10 return Cypress.$(siblings);11});12describe('My First Test', function() {13 it('Does not do much!', function() {14 cy.get('input[name="q"]').type('Hello World')15 cy.get('button[type="submit"]').click()16 cy.get('a').nextall('div').should('have.class', 'rc')17 })18})
Using AI Code Generation
1cy.get('a').nextAll().should('have.length', 2)2cy.get('a').prevAll().should('have.length', 2)3cy.get('a').siblings().should('have.length', 2)4cy.get('a').nextUntil('li').should('have.length', 2)5cy.get('a').prevUntil('li').should('have.length', 2)6cy.get('a').each(($el, index, $list) => {7})8cy.get('a').filter('.active').should('have.length', 2)9cy.get('a').first().should('have.class', 'active')10cy.get('a').last().should('have.class', 'active')11cy.get('a').eq(1).should('have.class', 'active')12cy.get('a').contains('Sign in').should('have.length', 2)13cy.get('a').invoke('attr', 'href').should('include', 'google')14cy.get('a').contains('Sign in').click().and('have.class', 'active')15cy.wrap('Hello').should('contain', 'Hello')16cy.get('a').spread(($a1, $a2) => {17})18cy.get('a').then(($
Using AI Code Generation
1cy.get('button').nextAll().should('have.length', 3)2cy.get('button').nextUntil('button').should('have.length', 3)3cy.get('button').not('button').should('have.length', 3)4cy.get('button').parent().should('have.length', 3)5cy.get('button').parents().should('have.length', 3)6cy.get('button').parentsUntil('button').should('have.length', 3)7cy.get('button').prev().should('have.length', 3)8cy.get('button').prevAll().should('have.length', 3)9cy.get('button').prevUntil('button').should('have.length', 3)10cy.get('button').siblings().should('have.length', 3)11cy.get('button').next().should('have.length', 3)12cy.get('button').nextAll().should('have.length', 3)13cy.get('button').nextUntil('button').should('have.length', 3)14cy.get('button').not('button').should('have.length', 3)15cy.get('button').parent().should('have.length', 3)16cy.get('button').parents().should('have.length', 3)
Cypress is a renowned Javascript-based open-source, easy-to-use end-to-end testing framework primarily used for testing web applications. Cypress is a relatively new player in the automation testing space and has been gaining much traction lately, as evidenced by the number of Forks (2.7K) and Stars (42.1K) for the project. LambdaTest’s Cypress Tutorial covers step-by-step guides that will help you learn from the basics till you run automation tests on LambdaTest.
You can elevate your expertise with end-to-end testing using the Cypress automation framework and stay one step ahead in your career by earning a Cypress certification. Check out our Cypress 101 Certification.
Watch this 3 hours of complete tutorial to learn the basics of Cypress and various Cypress commands with the Cypress testing at LambdaTest.
Get 100 minutes of automation test minutes FREE!!