/** * 验证普通字串,只要字串中不包含特殊字符即可 */ function checkTextDataForNORMAL(strValue) { // 特殊字符验证格式 var regTextChar = /([/*/"/'<>//])+/ ; return !regTextChar.test(strValue); } /** * 验证整数,包含正整数和负整数 */ function checkTextDataForINTEGER(strValue) { var regTextInteger = /^(-|/+)?(/d)*$/; return regTextInteger.test(strValue); } /** * 检查是否为正整数 */ function isUnsignedInteger(strInteger) { var newPar=/^/d+$/ return newPar.test(strInteger); } function checkMoney(strValue, strUnit) { var testMoney = eval("/^//d+(//.//d{0," + (strUnit.length -1) + "})?$/"); return testMoney.test(strValue); } /** * 验证浮点数 */ function checkTextDataForFLOAT(strValue) { var regTextFloat = /^(-)?(/d)*(/.)?(/d)*$/; return regTextFloat.test(strValue); } /** * 验证数字 */ function checkTextDataForNUMBER(strValue) { var regTextNumber = /^(/d)*$/; return regTextNumber.test(strValue); } /** * 验证英文字母,不区分大小写 */ function checkTextDataForENGLISH(strValue) { var regTextEnglish = /^[a-zA-Z]*$/; return regTextEnglish.test(strValue); } /** * 验证大写英文字母 */ function checkTextDataForENGLISHUCASE(strValue) { var regTextEnglishUCase = /^[A-Z]*$/; return regTextEnglishUCase.test(strValue); } /** * 验证小写英文字母 */ function checkTextDataForENGLISHLCASE(strValue) { var regTextEnglishLCase = /^[a-z]*$/; return regTextEnglishLCase.test(strValue); } /** * 验证英文字母和数字,不区分大小写 */ function checkTextDataForENGLISHNUMBER(strValue) { var regTextEnglishNumber = /^[a-zA-Z0-9]*$/; return regTextEnglishNumber.test(strValue); } /** * 验证时间 */ function checkTextDataForTIME(strValue) { var regTextTime = /^(/d+):(/d{1,2}):(/d{1,2})$/; return regTextTime.test(strValue); } /** * 验证电话号码 */ function checkTextDataForPHONE(strValue) { var regTextPhone = /^(/(/d+/))*(/d)+(-(/d)+)*$/; return regTextPhone.test(strValue); } /** * 验证EMail */ function checkTextDataForEMAIL(strValue) { var regTextEmail = /^[/w-]+@[/w-]+(/.(/w)+)*(/.(/w){2,3})$/; return regTextEmail.test(strValue); } /** * 验证URL */ function checkTextDataForURL(strValue) { var regTextUrl = /^(file|http|https|ftp|mms|telnet|news|wais|mailto):(.+)$/; return regTextUrl.test(strValue); } /** * 验证邮政编码 */ function checkTextDataForPOST(strValue) { var regTextPost = /^(/d){6}$/; return regTextPost.test(strValue); }