資源描述:
《Jquery驗(yàn)證的介紹》由會(huì)員上傳分享,免費(fèi)在線閱讀,更多相關(guān)內(nèi)容在教育資源-天天文庫(kù)。
1、默認(rèn)校驗(yàn)規(guī)則(1)required:true??????????????必輸字段(2)remote:"check.php"?????????使用ajax方法調(diào)用check.php驗(yàn)證輸入值(3)email:true?????????????????必須輸入正確格式的電子郵件(4)url:true???????????????????必須輸入正確格式的網(wǎng)址(5)date:true??????????????????必須輸入正確格式的日期(6)dateISO:true???????????????必須輸入正確格式的日期(ISO),例如:2009-06-23,1998/01/22只驗(yàn)證格式,
2、不驗(yàn)證有效性(7)number:true????????????????必須輸入合法的數(shù)字(負(fù)數(shù),小數(shù))(8)digits:true????????????????必須輸入整數(shù)(9)creditcard:????????????????必須輸入合法的信用卡號(hào)(10)equalTo:"#field"??????????輸入值必須和#field相同(11)accept:???????????????????輸入擁有合法后綴名的字符串(上傳文件的后綴)(12)maxlength:5???????????????輸入長(zhǎng)度最多是5的字符串(漢字算一個(gè)字符)(13)minlength:10????
3、??????????輸入長(zhǎng)度最小是10的字符串(漢字算一個(gè)字符)(14)rangelength:[5,10]????????輸入長(zhǎng)度必須介于5和10之間的字符串")(漢字算一個(gè)字符)(15)range:[5,10]??????????????輸入值必須介于5和10之間(16)max:5?????????????????????輸入值不能大于5(17)min:10????????????????????輸入值不能小于10默認(rèn)的提示messages:{???required:"Thisfieldisrequired.",???remote:"Pleasefixthisfield.",???
4、email:"Pleaseenteravalidemailaddress.",???url:"PleaseenteravalidURL.",???date:"Pleaseenteravaliddate.",???dateISO:"Pleaseenteravaliddate(ISO).",???dateDE:"BittegebenSieeing眉ltigesDatumein.",???number:"Pleaseenteravalidnumber.",???numberDE:"BittegebenSieeineNummerein.",???digits:"Pleaseenteronlyd
5、igits",???creditcard:"Pleaseenteravalidcreditcardnumber.",???equalTo:"Pleaseenterthesamevalueagain.",???accept:"Pleaseenteravaluewithavalidextension.",???maxlength:$.validator.format("Pleaseenternomorethan{0}characters."),???minlength:$.validator.format("Pleaseenteratleast{0}characters."),???ran
6、gelength:$.validator.format("Pleaseenteravaluebetween{0}and{1}characterslong."),???range:$.validator.format("Pleaseenteravaluebetween{0}and{1}."),???max:$.validator.format("Pleaseenteravaluelessthanorequalto{0}."),???min:$.validator.format("Pleaseenteravaluegreaterthanorequalto{0}.")},如需要修改,可在js
7、代碼中加入:jQuery.extend(jQuery.validator.messages,{???????required:"必選字段",??remote:"請(qǐng)修正該字段",??email:"請(qǐng)輸入正確格式的電子郵件",??url:"請(qǐng)輸入合法的網(wǎng)址",??date:"請(qǐng)輸入合法的日期",??dateISO:"請(qǐng)輸入合法的日期(ISO).",??number:"請(qǐng)輸入合法的數(shù)字",??digits:"只能輸入整數(shù)",??creditcard: