More commonly used:
function Checkishanzi (s) {//var patrn =/^[\u2e80-\u9fff]$/; Chinese characters in//unicode encoding/[^\x00-\x80]/var patrn =/[^\x00- \x80]/; if (!patrn.exec (s)) return false return true}//Check login: Only 4-20 entries starting with a letter, with numbers, "_", "." Can be entered. The string function Checkisregisterusername (s) {var patrn =/^[a-za-z]{1} ([a-za-z0-9]|[. _]) {3,19}$/; if (!patrn.exec (s)) return false return true}//Verify user name: Only 4-30 strings beginning with a letter function checkistruename (s) {var patrn =/^ [A-za-z] {4,30}$/; if (!patrn.exec (s)) return false return true}//Check password: Enter only 6-20 letters, numbers, underscore function checkispasswd (s) {var patrn =/^ (w) {6,20}$/; if (!patrn.exec (s)) return false return true}//Verify the normal phone, fax number: Can "+" start, in addition to the number, can contain "-" function Checkistel (s) {var patrn = /^[+]{0,1} (d) {1,4}[]? ([-]? ((d) | []) {1,12}) +$/; if (!patrn.exec (s)) return false return true}//Verify mobile number function Checkismobil (s) {var patrn =/^0? 13[0-9]|15[012356789]|18[0236789]|14[57]) [0-9]{8}$/; if (!patrn.exec (s)) return false return true}//Check zip code function CheckisPostalCode (s) {var patrn =/^[a-za-z0-9]{3,12}$/; if (!patrn.exec (s)) return false return true}//check whether the IP address function checkisip (s) {var patrn =/^[0-9.] {1,20}$/; if (!patrn.exec (s)) return false return true}//checksum emailfunction Checkisemail (s) {//var regex =/^\w+ ((-\w+) | ( \.\w+)) *\@[a-za-z0-9]+ ((\.| -) [a-za-z0-9]+] *\. [a-za-z0-9]+$/; var reg =/^ ([a-za-z0-9_-]) [email protected] ([a-za-z0-9_-]) + ((\.[ a-za-z0-9_-]{2,3}) {$/}); var patrn =/^ ([0-9a-za-z\-_\.] +) @ ([0-9a-za-z]+\. [A-za-z] {2,3} (\. [A-za-z] {2})?) $/g; if (!patrn.exec (s)) return false return true}//Verify the type function check (axd,lbm,int) {var s = $ ("#" + Axd). Val (); switch (int) {case 0:if (s = = "") {$ ("#textt"). Text (LBM + "cannot be empty"); $ (". Tip"). FadeIn (200); return false} break; Case 1:if (!checkisdigit (s)) {$ ("#textt"). Text (LBM + "can only be made up of numbers, please re-enter!) "); $ (". Tip"). FadeIn (200); return false} break; Case 2:if (Checkisdigit (s)) {$ ("#textt"). Text (LBM + "cannot be made up of numbers, please re-enter!) "); $ (". Tip"). FadeIn (200); return false} break; Case 3:if (!checkisregisterusername (s)) {$ ("#textt"). Text (LBM + "can only enter 4-20 letters beginning with a letter, with numbers," _ ",". "). String, please re-enter! "); $ (". Tip"). FadeIn (200); return false} break; Case 4:if (!checkistruename (s)) {$ ("#textt"). Text (LBM + "You can enter only 4-30 strings that start with a letter, please reenter!) "); $ (". Tip"). FadeIn (200); return false} break; Case 5:if (!CHECKISPASSWD (s)) {$ ("#textt"). Text (LBM + "can only enter 6-20 letters, numbers, underscores, please re-enter!) "); $ (". Tip"). FadeIn (200); return false} break; Case 6:if (!checkistel (s)) { $ ("#textt"). Text (LBM + "Check normal phone, fax number: Can" + "start, in addition to the number, can contain"-", please re-enter!) "); $ (". Tip"). FadeIn (200); return false} break; Case 7:if (!checkismobil (s)) {$ ("#textt"). Text (LBM + "incorrect, please re-enter!) "); $ (". Tip"). FadeIn (200); return false} break; Case 8:if (!checkispostalcode (s)) {$ ("#textt"). Text (LBM + "incorrect, please re-enter!) "); $ (". Tip"). FadeIn (200); return false} break; Case 9:if (!checkisip (s)) {$ ("#textt"). Text (LBM + "incorrect, please re-enter!) "); $ (". Tip"). FadeIn (200); return false} break; Case 10:if (!checkisemail (s)) {$ ("#textt"). Text (LBM + "incorrect, please re-enter!) "); $ (". Tip"). FadeIn (200); return false} Case 11:if (!checkishAnzi (s)) {$ ("#textt"). Text (LBM + "can only be made up entirely of Chinese characters, please re-enter!) "); $ (". Tip"). FadeIn (200); return false} break; } return true}function Checkrid (Axd, LBM, int) {var s = $ ("input[name=" + Axd + "]:checked"). Val (); switch (int) {case 0:if (s = = "") {$ ("#textt"). Text (LBM + "cannot be empty"); $ (". Tip"). FadeIn (200); } break; }}//Validation judgment function checked (ASD) {for (var i = 0; i < asd.length; i++) {var axd = asd[i][0]; var lbm = asd[i][1]; var int = asd[i][2]; if (!check (Axd, LBM, int)) {return false; Break }} return true; function ShowName (i) {if (i = = 1) {$ ("#textt"). Text ("modified successfully"); $ (". Tip"). FadeIn (200); } else if (i = = 0) {$ ("#textt"). Text ("Add success"); $ (". Tip"). FadeIn (200); }if (i = = 2) {$ ("#textt"). Text ("delete succeeded"); $ (". Tip"). FadeIn (200); }}
jquery Regular Validation