校验邮箱方法
function validEmail(v){
var result = false;
var a = v.indexOf('-')>0?v.replace(/-/g,''):v;
var len = a.length;
if(len == 0)return true;
if(v != undefined && v != "" && v != null){ //在此校验
var reg = /^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/;
result = reg.test(a);
}
return result;
}
校验电话
function validWPhone(v){
var result = false;
var len = v.length;
if(len == 0) return true;
if(v != undefined && v != "" && v != null){
var isPhone = /^([0-9]{3,4}-)?[0-9]{7,8}$/;
var isMob=/^[1][0-9]{10}$/;
if(isMob.test(v)||isPhone.test(v)){
result = true;
}
else{
result = false;
}
}
return result;
}
校验手机号
function validCustomerPhone(v){
var result = false;
var a = v.indexOf('-')>0?v.replace(/-/g,''):v;
var len = a.length;
if(len == 0) return true;
if(v != undefined && v != "" && v != null){
var reg = /^[1][0-9]{10}$/;
result = reg.test(a);
}
return result;
}