手机号码和邮箱格式验证
function checkMobile() {
var sMobile = document.getElementById(“phone”).value
var radio = document.getElementsByName(“type”);
if (radio[0].checked) {
if (!(/^1[3|4|5|7|8][0-9]\d{8}$/.test(sMobile))) {
document.getElementById(“warShow”).innerHTML = “请输入正确的手机号码!”;
return false;
}
}
else {
if (!/^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/.test(sMobile)) {
document.getElementById(“warShow”).innerHTML = “请输入有效的E_mail!”;
return false;
}
}
}