Common JS Verification Code
// Whether the verification function isempty (s) {var lll = trim (s); If (lll = NULL | lll. length = 0) return true; elsereturn false ;}
// Delete the space function ltrim (STR) {If (Str. length = 0) Return (STR); else {var idx = 0; while (Str. charat (idx ). search (/\ s/) = 0) idx ++; Return (Str. substr (idx ));}}
// Delete the space function rtrim (STR) {If (Str. length = 0) Return (STR); else {var idx = Str. length-1; while (Str. charat (idx ). search (/\ s/) = 0) idx --; Return (Str. substring (0, idx + 1 ));}}
// Delete the space between the left and right sides of the string function trim (STR) {return (rtrim (ltrim (STR )));}
/* Date comparison */function comparedate (date1, date2) {If (TRIM (date1) = trim (date2) return 0; If (TRIM (date1)> trim (date2) return 1; if (TRIM (date1) <trim (date2) Return-1 ;}
// Check whether emailfunction isemail (EML) {If (TRIM (EML )! = '') {Var Re = new Regexp (" @ [\ W] + (\\. [\ W] +) + {1} quot;); Return (Re. test (EML);} else return (true );}
// Whether the phone number is function istel (TEL) {var charcode; For (VAR I = 0; I <Tel. length; I ++) {charcode = Tel. charcodeat (I); If (charcode <48 & charcode! = 45 | charcode> 57) return false;} return true ;}
// Check whether it is a real number function isnumber (Num) {var Re = new Regexp ("^ -? [\ D] * \.? [\ D] * {1} quot;); If (Re. Test (Num) Return (! Isnan (parsefloat (Num); elsereturn (false );}
// Check whether it is an integer function isinteger (Num) {var Re = new Regexp ("^ -? [\ D] * {1} quot;); If (Re. Test (Num) Return (! Isnan (parseint (Num); elsereturn (false );}
// Check whether it is a combination of numbers and letters and is a 4-6-digit function isnumorletters (STR) {var Re = new Regexp (/^ [a-zA-Z0-9] {} $ /); if (Re. test (TRIM (STR) Return (true); else return (false );}