var verification={ //Verify time Format 8:00 vtime: function (s) { var ar = s.split (': '), flag = true; if (ar.length != 2) FLAG = false; else { if ( !/^[\d]+$/.test (ar[0]) | | !/^[\d]+$/.test (ar[1]) FLAG = false; else { if (parseint (ar[0]) < 0 | | parseint (ar[0]) > 23 | | parseint (ar[1]) < 0 | | parseint (ar[1]) > 59) FLAG = false; } } return flag; }, //determines whether the character entered is an integer isInteger:function (str) { if (str.length!=0) { var reg=/^[-+]?\d*$/; Return reg.test (str); } }, //verify phone isphone : function (str) { if (str.length!=0) { var reg=/^((\d2,3) | (\d{3}\-))? (0\d2,3|0\d{2,3}-)? [1-9]\d{6,7} (\-\d{1,4})?$/; return reg.test (str); } }, //Verification URL isUrl:function (str) { if (str.length!=0) { var reg=/^http:\/\/[a-za-z0-9]+\. [a-za-z0-9]+[\/=\?%\ -&_~ ' @[\]\ ': +!] * ([^<>\ "\"]) *$/ ; return reg.test (str); } }, //determine if the input ZIP code (only six-bit) is correct iszip:function (str) {&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSp;if (str.length!=0) { var reg=/^\d{6}$/; return reg.test (str); } } , //determine if the email format entered is correct isEmail:function ( STR) { if (str.length!=0) { var reg=/ ^\w+ ([-+.] \w+) *@\w+ ([-.] \w+) *\.\w+ ([-.] \w+) *$/; return Reg.test (str); } }, //Verifying longitude isLon:function (str) {&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSp; if (str.length!=0) { var reg=/^-? (?:(? : 180 (?: \. 0{1,5})?) | (?:(?:(? : 1[0-7]\d) | (?: [1-9]?\d)] (?:\. \d{1,5})) $/; return reg.test ( STR); } }, Verify latitude isLat:function (str) { if (str.length!=0) { var reg=/^-? ((0|\d| [1-8]\d|] (\.\d{1,7})? | 90 (\.0{1,7})?)? $/; return reg.test ( STR); } }, //Verify special character isalllegal:function (str) { var reg = /^[^@\/\ ' \\\ "#$%&\^\*]+$/; return reg.test (str); }, //Verify that the first 5 characters are Chinese characters, verify the name of the hospital entered, or long text isStartChinese:function (str) { var s=str.substr (0, 5); var reg=/^[\u0391-\uFFE5]+$/; return reg.test (str); }, //determines whether the character entered is Chinese isChinese:function (str) { if (str.length!=0) { var reg=/^[\u0391-\uFFE5]+$/; return reg.test (str); } } };
JS various parameters simple validation