I. Verification class 1, digital verification 1.1 integer / ^ (-|/ ) 1.2 greater than 0 integers (used for ID authentication) / ^ / D $ / .test (STR) 1.3 negative integer verification / ^-/d //.test (STR) 2, time class 2.1 short time, shaped (13:04:06) Function istime (str) {var A = STR. Match (/ ^ (/ d {1, 2}) (:)? (/ d {1, 2}) / 2 (/ d {1, 2}) $ /); if (a == null) {Alert ('Enter parameters are not time format'); return false;} if (a [1]> 24 || a [3]> 60 || a [4]> 60) {Alert ("time format is not pair"); Return true;} 2.2 Short date, shaped (2003-12-05) Function strdatetime (STR) {var r = str.match (/ ^ (/ D {1, 4}) (- | //) (/ D {1, 2}) / 2 (/ d {1, 2}) $ /); if (r == null) Return False; var D = new date (r [1], r [3] - 1, R [4]); return (d.Getfullyear () == r [1] && (D.getMonth () 1) == r [3] && d.getdate () == r [4]); } 2.3 long, shaped (2003-12-05 13:04:06) Function strdatetime (STR) {var REG = / ^ (/ d {1, 4}) (- | //) (//) (/ D {1 2}) / 2 (/ d {1, 2}): (/ d {1, 2}): (/ d {1, 2}) $ /; var r = Str.match (reg); if (r == null) Return False; var D = ne W Date (R [1], R [3] -1, R [4], R [5], R [6], R [7]); return (d.Getfullyear () == r [1] && (D.GETMONTH () 1) == r [3] && D.getdate () == r [4] && D.GetHours () == R [5] && D.getminutes () == r [6] && D. Getseconds () == r [7]);} 2.4 only year and month. If (2003-05, or 2003-5) 2.5 is only hours and minutes, shaped (12:03) 3, the value of all forms of the form cannot be empty 3.2 Multi-line text boxes cannot be empty.
3.3 Multi-line text boxes The value cannot exceed SMAXSTRLENG 3.4 Multi-line text boxes cannot be less than SMIXSTRLENG 3.5 judge whether the radio box is selected. 3.6 Judge whether the check box is selected. 3.7 check box all, multi-selection, all incorrect, reverse selection 3.8 file type 4, character class 4.1 judgment character is all made of AZ or AZ letter < Input οnblur = "if (/ [^ a-za-z] /g.test (this.Value)) Alert ('error')> 4.2 Judgment character consists of letters and numbers. 4.3 Judge characters are composed of letters and numbers, underscores, point And the beginning can only be underscore and letters /^ ([[-Za-z_]}}) ([/w]*) $/g.test (STR) 4.4 string replacement function.Replace (); 5 Browser class 5.1 Decision browser type WINDOW.NAVIGATOR.APPNAME 5.2 Judging IE version of IE WINDOW.NAVIGATOR.AppVersion 5.3 Judging the client's resolution Window.Screen.Height; Window.Screen.width; 6, combined with class 6.1 email judgment.
Function ismail (mail) {return (new regexp (/ ^ / w ) | (/ w )) * / @ [A-ZA-Z0-9] (/. | -) [ A-ZA-Z0-9] ) * /. [A-ZA-Z0-9] $ /). TEST (MAIL));} 6.2 Verification of mobile phone number 6.3 identity card Verification Function isidcardNo (NUM) { IF (ISNAN (NUM)) {Alert ("Input is not a number!"); RETURN FALSE;} var len = Num.length, Re; if (len == 15) RE = new regexp (/ ^ (/ ^ 6}) ()? (/ D {2}) (/ d {2}) (/ d {2}) $ /); Else IF (len == 18) Re = New Regexp (/ ^ (/ d {6}) () (/ d {4}) (/ d {2}) (/ D {3}) (/ d) $ /); ELSE {ALERT ("The number of digits entered!"); return false;} var A = Num.match (re); if (a! = null) {if (len == 15) {var D = new date "19" a [3] "/" a [4] "/" a [5]); var b = d.Getyear () == a [3] && (d.getMonth () 1) == a [4] && d.getdate () == a [5];} else {var d = new date (a [3] "/" a [4] "/" a [5 ]); Var b = d.Getfullyear () == a [3] && (d.getMOnth () 1) == a [4] && d.getdate () == a [5];} if (! B) ) {Alert ("Enter ID" A [0] "Birthday is not right! "); return false;}} Return True;} 3.7 check box all select, multi-selection, unlike, reverse selection