js判断大全(JS judgment book).docVIP

  • 10
  • 0
  • 约8.14千字
  • 约 24页
  • 2017-10-07 发布于河南
  • 举报
js判断大全(JS judgment book)

js判断大全(JS judgment book) * Determines whether the specified content is empty. If it is empty, pop up the warning box * / Function isEmpty (theValue, strMsg) { If (theValue== ) { Alert (strMsg+ cant be empty); Return true; } Return false; } * Chinese judgment function allows shengpizi with * instead of English The return TRUE indicates the condition, and the return false indicates no agreement * / Function isChinese (STR) { Var badChar = ABCDEFGHIJKLMNOPQRSTUVWXYZ; BadChar = abcdefghijklmnopqrstuvwxyz; BadChar = 0123456789; BadChar + = + ; / / half width and full width space BadChar = @#$%^ ` ~! (); \\, -_=+]\\|: \ ? ; / / / does not contain the symbol English * or. If (==str) { Return false; } For (VaR i=0 I VaR; C = str.charAt (I); / / string character in str If (badChar.indexOf (c) -1) { Return false; } } Return true; } * The numeric judgment function returns true, indicating all the digits, and returns false, indicating that all numbers are not numbers * / Function isNumber (STR) { If (==str) { Return false; } Var reg = /\D/; Return str.match (reg) ==null; } * Determines whether a given string is a specified length Is to return true, not to return false * / Function isNumber_Ex (STR, len) { If (==str) { Return false; } If (str.length, =len) { Return false; } If ((isNumber (STR)) { Return false; } Return true; } * Money judgment function, allow the first - said to owe Returns true indicating the correct format and returns false indicating a format error * / 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; } * English judgment function, return true, that is all in English, return false, not all in English * / Function isLetter (STR) { If (==str) { Return false; } For (VaR, i=0, I, VaR, C = str.charAt (I)); If ((c a ||c Z (c) and A ||c Z)) { Return false; }

您可能关注的文档

文档评论(0)

1亿VIP精品文档

相关文档