Var newwin = null
/ / -------------------------------------------------------------------------------------------- - pop-up window (address, wide, high)
Function newWindow (to, w, h)
{
IF (! newwin || newwin.closed)
{
NewWin = WINDOW.Open (to, "indexww", "width =" w ", height =" h ", scrollbars")
}
Else
{
newwin.close ()
NewWin = WINDOW.Open (to, "indexww", "width =" w ", height =" h ", scrollbars")
}
newwin.focus ()
}
/ / -------------------------------------------------------------------------------------------- - Inspection Character Function Ischar (s) {var ErrorChar; VAR Badchar = "> <, [] {}? / = | // '/" :; ~! @ # $% ^ & () `";
IF (s == ") {alert (" Please enter content! ") Return False;}
IF (iswhitespace (s)) {alert ("Input fleemers can not contain space characters, please re-enter!"); return false;} errorchar = ischarsinbagex (s, badchar) if (ErrorChar! = ") {Alert "The character" s "you entered is invalid, / n / n Do not enter" ErrorChar "in characters!"); Return False;}
Return True;}
/ / -------------------------------------------------------------------------------------------- --- Test the user's name Function isusername (s) {var errorchar; var badchar = "> <, [] {}? / = | // '/" :; ~! @ # $% ^ & () `" ; If (iSempty (s)) {Alert ("Please enter your username!");} If (iswhitespace (s)) {alert ("Enter the user name cannot contain space characters, please re-enter? Quot ;);} Errorchar = ischarsinbagex (s, badchar) if (ErrorChar! = ") {Alert (" You entered username " S " is an invalid username, / n / n please do not be in the user In the name, enter the character " errorchar "! / N / n Please re-enter the legal username! "); Return false;} if (s.ley <1 || s.length> 20) {Alert (" User Name Must be between 1 to 20 characters ") Return False}
Return True;}
// Common function
/ / -------------------------------------------------------------------------------------------- --- Whether the character is in the s, bag) {var i; // search through string's character is in bag, append to returnstring.for (i = 0; i
Function isempty (s) {return ((s == null) || (s.length == 0));}
/ / -------------------------------------------------------------------------------------------- ---- Space Judgment Function IsWhitespace (S) {var white = "/ t / n / r"; var i; for (i = 0; i
Return false;}
/ / -------------------------------------------------------------------------------------------- ---- Leap year judgment function isleApyear (thisyear) {return ((Thisyear% 4 == 0) && (thisyear% 100! = 0)) || (thisyear% 400 == 0))
}
/ / -------------------------------------------------------------------------------------------- ---- Function ischarsinbagex (S, Bag) {VAR I, C; // search through string's character is in bag, append to returbtring.for (i = 0; I
/ / -------------------------------------------------------------------------------------------- ---- Whether to select a radio button Function Radioselected (Radiobth) {for (i = 0; I / / -------------------------------------------------------------------------------------------- ---- Year judgment function isyear (s) {var today = new date () thisyear = Today.GetyEAR () var badchar = "> <, [] {}? / = | // '/" :; ~ ! @ # $% ^ & `"; Var len = s.Length; if (ISEMPTY (S)) {Alert ("must enter the year") Return False;}} (ischarsinbag (s, badchar)) {Alert (" Years Input Illegal ") Return False;} = ((" "l!"); Return false;} if (! Ischarsinbag (s, "0123456789")) {Alert (" Please check if your year is a number! "); Return false;} if (S <1800) {Alert (" Year of 1800 "); Return False;} //iff ((THISYEAR-S) <0 ) {// alert ("year must not be greater than" thisyear); // return false; //} return true;} // -------------------- ------------------------------ Email Judgment Function ISEMAIL (ISEMPTY (S)) {Alert (" The input E-mail address cannot be empty, please enter! "); Return False;} // iswhitespace (s)) {alert (" Input E-mail address can not contain space characters, please re- Enter! "); Return False;} var i = 1; var len = s.gength; IF (len> 40) {alert ("E-mail address length can not exceed 40!"); return false;} POS1 = S.Indexof ("@"); POS2 = S.Indexof ("."); POS3 = S.lastIndexof ("@"); POS4 = S.lastIndexof ("."); if ((((POS1 <= 0) || (POS1 == LEN) || (POS2 <= 0) || (POS2 == LEN)) {Alert ("Please enter a valid E-mail address!"); Return false;} else {ix ((POS1 == POS2 - 1) || (POS1 == POS2 1) || (POS1! = POS3) // Find TWO @ || (POS4 if (! isCharsInBag (s, ".-_ ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 @")) {alert ( "email address only contain characters ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789.-_@/n" "please re-enter"); return false;} return true; } // ----------------------------------------------------------------------------------------------------------------------------------------------------- --- Digital judgment Function isnum (s) {if (ISEMPTY (S)) {Alert ("must enter a number") Return False;} if (! Ischarsinbag (s, "0123456789")) {Alert ("Please check Whether you entered is a number! "); Return false;} // if (S <1) {// alert (" The input number is greater than 0! "); // Return false; ///} // IF ( S> 2000) {// alert ("The input number is less than 2000!"); // Return False; //} return true; / / -------------------------------------------------------------------------------------------- - ID card judgment function iscardNum (s) {if (ISEMPTY (S)) {Alert ("must enter a number") Return False;} if (! Ischarsinbag (s, "0123456789")) {Alert ("Please check Are you entered? Quot;); return false;} if (s.Length == 15 || s.length == 18) {return true;} else {Alert ("The number of input numbers is 15 or 18-bit! "); Return false;}} / / -------------------------------------------------------------------------------------------- - Zip code judgment Function iszipcode (s) {if (! ISempty (s)) {if (! Ischarsinbag (s, "0123456789")) {Alert ("Please check if you entered is a number!"); Return False;}} (sLength == 6) {Return true;} else {alert ("The input postal code length is 6!"); return false;}} else {return true;}}}}}} / / -------------------------------------------------------------------------------------------- - Date judgment Function Chkdate (DateStr) {if (ISempty ("must enter the date") Return False;} var lthdatestrlthdateStr = DATESTR.LENGTH; var TMPY = "; var TMPM =" "; var TMPD = ""; // var status; status = 0; For (i = 0; i Return True;}