if (!objRegExp.test(strValue))
return false;
else {
var arrayDate = strValue.split(RegExp.$1);
var intDay = parseInt(arrayDate[2], 10);
var intYear = parseInt(arrayDate[0], 10);
var intMonth = parseInt(arrayDate[1], 10);
if (intMonth > 12 || intMonth < 1) {
return false;
}
var arrayLookup = { '1': 31, '3': 31, '4': 30, '5': 31, '6': 30, '7': 31,
'8': 31, '9': 30, '10': 31, '11': 30, '12': 31
}
if (arrayLookup[parseInt(arrayDate[1])] != null) {
if (intDay <= arrayLookup[parseInt(arrayDate[1])] && intDay != 0)
return true;
}
if (intMonth - 2 == 0) {
var booLeapYear = (intYear % 4 == 0 && (intYear % 100 != 0 || intYear % 400 == 0));
if (((booLeapYear && intDay <= 29) || (!booLeapYear && intDay <= 28)) && intDay != 0)
return true;
}
}
return false;
},
isZip: function(value) {
var validateReg = /^[0-9]{6}$/;
return validateReg.test(value);
},
checkSpecialChar: function(value) {
var validateReg = /([~!@#$%^&*\/\\,.\(\)]){6,16}$/;
return validateReg.test(value);
},
CheckSpecialString: function(value) {
var validateReg = /[\u0000-\u0008\u000B\u000C\u000E-\u001F\uD800-\uDFFF\uFFFE\uFFFF]/;
return validateReg.test(value);
},
isTel: function(s) {
var patrn = /^\d{3,4}-\d{7,8}(-\d{3,4})?$/
if (!patrn.exec(s)) return false
return true
},
js验证模型自我实现的具体方法(6)
内容版权声明:除非注明,否则皆为本站原创文章。