JS several common form input judgment

xiaoxiao2021-03-06  95

// Function Name: Chksafe // Features: Check if "'",' // ', "/" // Parameter Description: String // Return Value: 0: Yes 1: Not Function Chksafe a) {RETURN 1; / * fibdn = new array ("'", "//", ",", ";", "/"); i = fibdn.length; j = a.length For (ii = 0; II 1) {if ((i-temp)> 3) {if ((i-tempd)> 0) {RETURN 1;}}} Return 0 } // OPT1 decimal OPT2 negative number // Check NUM if the OPT2 is 1 when the NUM is negative // ​​When the OPT1 is 1, it checks whether NUM is decimal // Return 1 is correct, 0 is the wrong function chknbr (Num, OPT1 , OPT2) {var i = Num.length; var staus; // staus is used to record. Number status = 0; if ((OP T2! = 1) && (Num.Charat (0) == '-')) {// Alert ("You Have Enter A Invalid Number."); return 0;} // When the last bit is. IF (Num.Charat (I-1) == ') {// alert ("You Have Enter A Invalid Number."); Return 0;} for (j = 0; J

= 0) && (Month == 2) && (DAY == 29)) {// alert ("this is not a leap year!"); Return 0;} = ((Month <= 7) && ((Month) % 2) == 0) && (DAY> = 31)) {// alert ("this Month Is A Small Month!"); Return 0;} IF ((Month> = 8) && ((Month% 2) == 1) && (DAY> = 31)) {// alert ("this Month Is A Small Month!"); Return 0;}} ((Month == 2) && (day == 30)) {/ / Alert ("The Febryary NEVER HAS THIS Day!"); return 0;} Return 1;} // function name: fucpwdchk // function introduction: Check if a non-numeric or letter // parameter description: String to check // return value: 0: 1 comprising: all numbers or letters function fucPWDchk (str) {var strSource = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; var ch; var i; var temp; for (i = 0; i <= (str.length -1); i ) {CH = str.Charat (i); temp = strsource.indexof (ch); if (Temp == - 1) {RETURN 0;}} f (strsource.indexof (ch) == - 1) {RETURN 0;} else {return 1;}} function jtrim (str) {while (str.Charat (0) == "") {str.sustr (1);} while (str.charat (Str.Charat) Str.Length-1) == "" "{str.substr (0, str.length-1);} Return (STR);} // function name: fucchecknum // function introduction: Check if it is a number // parameter description: The number // return value to check: 1 is a number, 0 is not a digital function fucchecknum (NUM) { VAR I, J, STRTEMP; Strtemp = "0123456789"; if (Num.Length == 0) Return 0 for (i = 0; I

Check if it is a phone number / / parameter description: The string // return value to check: 1 is legal, 0 is illegal function fucchecktel (tel) {var i, j, startemp; strtemp = "0123456789 - #) # "; For (i = 0; i = 0) && (I) <= 255)) SUM = SUM 1; Else Sum = SUM 2;} Return SUM;}