*
Determines whether the specified content is null. If it is null, a warning box is displayed.
*/
Function isEmpty (theValue, strMsg ){
If (theValue = ""){
Alert (strMsg + "cannot be blank! ");
Return true;
}
Return false;
}
/*
Chinese judgment function, which allows the replacement of uncommon words with English "*"
True indicates that the condition is met, and false indicates that the condition is not met.
*/
Function isChinese (str ){
Var badChar = "ABCDEFGHIJKLMNOPQRSTUVWXYZ ";
BadChar + = "abcdefghijklmnopqrstuvwxyz ";
BadChar + = "0123456789 ";
BadChar + = "" + ""; // halfwidth and fullwidth Spaces
BadChar + = "'~! @ # $ % ^ & ()-_ = +] \\| :;\" \\' <,>? /"; // It does not contain the English characters * or.
If ("" = str ){
Return false;
}
For (var I = 0; I var c = str. charAt (I); // character in string str
If (badChar. indexOf (c)>-1 ){
Return false;
}
}
Return true;
}
/*
Number judgment function. If true is returned, all digits are returned. If false is returned, not all digits are returned.
*/
Function isNumber (str ){
If ("" = str ){
Return false;
}
Var reg =/\ D /;
Return str. match (reg) = null;
}
/*
Determines whether the given string is a number of the specified length.
True is returned, not false.
*/
Function isNumber_Ex (str, len ){
If ("" = str ){
Return false;
}
If (str. length! = Len ){
Return false;
}
If (! IsNumber (str )){
Return false;
}
Return true;
}
/*
The money judgment function allows the first digit to be "-" to indicate that the account is in arrears.
True indicates that the format is correct. false indicates that the format is incorrect.
*/
Function isMoney (str ){
If ("" = str ){
Return false;
}
For (var I = 0; I var c = str. charAt (I );
If (I = 0 ){
If (c! = "-" & (C <"0" | c> "9 ")){
Return false;
} Else if (c = "-" & str. length = 1 ){
Return false;
}
} Else if (c <"0" | c> "9 "){
Return false;
}
}
Return true;
}
/*
Returns true to indicate all English letters, and false to indicate not all English letters.
*/
Function isLetter (str ){
If ("" = str ){
Return false;
}
For (var I = 0; I var c = str. charAt (I );
If (c <"a" | c> "z") & (c <"A" | c> "Z ")){
Return false;
}
}
Return true;
}
/*
Space determines. If a space is included, false is returned. If a space is not included, true is returned.
"" Cannot be judged
*/
Function notInSpace (str ){
If ("" = str ){
Return false;
}
Var badChar = "";
BadChar + = "";
For (var I = 0; I var c = str. charAt (I); // character in string str
If (badChar. indexOf (c)>-1 ){
Return false;
}
}
Return true;
}
/*
The invoice number judgment function. If the return value is true, the return value is the invoice number. If the return value is false, the return value is invalid.
*/
Function isFPH (str ){
If ("" = str ){
Return false;
}
For (var I = 0; I var c = str. charAt (I );
If (c <"0" | c> "9") & (c! = "-") & (C! = ",")){
Return false;
}
}
Return true;
}