[javascript]代码库
//邮箱格式检查
function emailCheck() {
var email = document.getElementById("email").value;
document.getElementById('emailDiv').style.visibility = "visible";
if (email != "") {
var re = /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(.[a-zA-Z0-9_-])+/;
var result = re.test(email);
if (result) {
document.getElementById('emailDiv').className = "yes";
$("#emailError").html("格式正确!");
return true;
} else {
document.getElementById('emailDiv').className = "wrong";
$("#emailError").html("邮箱格式错误!");
return false;
}
} else {
document.getElementById('emailDiv').className = "wrong";
$("#emailError").html("请填写邮箱!");
return false;
}
}