JavaScript technology often used in BS development

xiaoxiao2021-03-06  21

JavaScript technology, often used in B / S development, verification class 1, digital verification internal 1.1 integer  1.2 greater than 0 integers (verification of IDs) 1.3 negative integers The verification 1.4 integer cannot Big than IMAX 1.5 integers cannot be less than iMin2, time class 2.1 short time, shaped like (13:04:06) 2.2 short date, shaped (2003-12-05) 2.3 long, shape (2003-12) -05 13:04:06) 2.4 only year and month. Shape (2003-05, or 2003-5)  2.5 Only hours and minute, shaped (12:03) 3, the value of all forms of all forms cannot be empty 3.2 Multi-line text box Is empty. 3.3 Multi-line text boxes can not exceed the smaxstrleng 3.4 multi-line text boxes cannot be less than SMIXSTRLENG  3.5 judgment radio box is selected.  3.6 Judgment check box is selected. 3.7 check box all select, multi-selection, unlike, reverse selection  3.8 file upload process judgment file type 4, character class 4.1 judgment characters all by AZ or AZ The word letter composition  4.2 Judgment character consists of letters and numbers. 4.3 Judgment character consists of letters and numbers, underscore, codes. And only the underscore and letters 4.4 string replacement function.Replace (); 5, browser class 5.1 judgment browser type  5.2 judgment IE version  5.3 judges the resolution of the client, combined with the judgment of the class 6.1 email. 6.2 Verification of mobile phone number 6.3 identity card verification

Second, the function

1. Time and related control class 1.1 Calendar  1.2 Time Control 13,000 years  1.4 Display Dynamic display clock effect (text, such as OA) 1.5 Display Dynamic display clock effect (image, like watch) 2, form 2.1 Automatic Generation Form 2.2 Dynamic Add, Modify, Delete Elements in the Downlink Box 2.3 You can enter the following box. Down-pull box 2.4 Multi-line text boxes can only be entered. If you are more input, you automatically reduce the iMAX text (mostly used for SMS send) 3, print class 3.1 Print Control 4, Event class 4.1 Mask Right click 4.2 Shield all function keys 4.3 -> and <- f5 F11, F9, F14.4 Shielding Competence Ctrl N5, web design class  5.1 Continuous scrolling text, picture (note is continuous, no blank appearance in two paragraphs and pictures)  5.2 HTML editing control class  5.3 color Select box control  5.4 drop-down menu  5.5 Two layers or multi-level drop-down menu  5.6 Imitation IE button. (Effects, such as rongshuxa.com's navigation section)  5.7 status bar, the dynamic effect of the Title column (there are many examples, you can study)  5.8 After double-click, the web page automatically scrolls 6, the tree structure. 6.1 ASP SQL version  6.2 ASP XML SQL version 6.3 java SQL or Java SQL XML7, borderless effect 8, moving down-pull frame technology 9, text sort

I. Verification class 1, digital verification internal 1.1 integer  / ^ (- | / )? / D $ /. Test (str) 1.2 greater than 0 integers (used for ID verification)   / ^ / 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 ('input parameter is not time format'); Return False;} IF (A [ 1]> 24 || A [3]> 60 || A [4]> 60)  {lert ("Time format is wrong"); RETURN FALSE  } 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}): (/ d {1, 2}) $ /; var r = str.match (REG); IF (r == null) Return false; var d = new 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.ge TDATE () == r [4] && D.GetHours () == r [5] && d.getminutes () == r [6] && D.getSeconds () == r [7]); } 2.4 Only year and month. For example, (2003-05, or 2003-5) 2.5 is only hours and minutes, such as (12:03) 3, the value of all forms of all forms cannot be empty  4.3 Judgment character by letters and numbers, underline The point is composed. And the beginning can only be underscore and letters / ^ ([A-ZA-Z_] {1}) ([/ w] *) $ / g.test (str) 4.4 string Replacement function.Replace (); 5, browser class  5.1 judgment browser type Window.navigat or.Appname  5.2 Judging IE version Window.navigat Or.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 mobile phone Number Verification  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 (/ ^ (/ d {6}) ()? (/ D {2} (/ d {2}) (/ d {2}) $ /); ELSE IF (len == 18) re = new regexp (/ ^ (/ d {6}) ()? (/ d {4}) (/ d {2}) (/ d {2}) (/ d {3}) (/ d) $ /);  Else {Alert ("Enter the number of digits!"); 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]; } 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!"); Return False } } return true;}

3.7 Collection of check boxes, multi-selection, unlike, reverse selection