日期:2014-05-16 浏览次数:20372 次
function isDate(str){ var reg = /^((((1[6-9]|[2-9]\d)\d{2})-(0?[13578]|1[02])-(0?[1-9]|[12]\d|3[01]))|(((1[6-9]|[2-9]\d)\d{2})-(0?[13456789]|1[012])-(0?[1-9]|[12]\d|30))|(((1[6-9]|[2-9]\d)\d{2})-0?2-(0?[1-9]|1\d|2[0-8]))|(((1[6-9]|[2-9]\d)(0[48]|[2468][048]|[13579][26])|((16|[2468][048]|[3579][26])00))-0?2-29-))$/ if (reg.test(str)){return true;}else{return false;} } function checkPhone( strPhone ) { var phoneRegWithArea = /^[0][1-9]{2,3}-[0-9]{5,8}$/; var phoneRegNoArea = /^[1-9]{1}[0-9]{5,8}$/; if( strPhone.length > 9 ) { if( phoneRegWithArea.test(strPhone) ){return true; }else{return false;} }else{ if(phoneRegNoArea.test(strPhone)){return true; }else{return false;} } } function isNumber( s ){ var regu = "^[0-9]+$"; var re = new RegExp(regu); if (s.search(re) != -1) { return true;} else { return false;} } function checkMobile( s ){ var regu =/^[1][3,5][0-9]{9}$/; var re = new RegExp(regu); if (re.test(s)) { return true; }else{ return false; } } function checkEmail(strEmail) { //var emailReg = /^[_a-z0-9]+@([_a-z0-9]+\.)+[a-z0-9]{2,3}$/; var emailReg = /^[\w-]+(\.[\w-]+)*@[\w-]+(\.[\w-]+)+$/; if( emailReg.test(strEmail) ){ return true; }else{ return false; } }