Home >Web Front-end >JS Tutorial >A way to write js email verification method
Verify Email
function check(){ var email=document.getElementById("email").value; var isemail=/^[a-z]([a-z0-9]*[-_]?[a-z0-9]+)*@([a-z0-9]*[-_]?[a-z0-9]+)+[\.][a-z]{2,3}([\.][a-z]{2})?$/i; if (email=="") { alert("请输入您的邮箱!"); return false; } if (email.length>25){ alert("长度太长"); return false } if (!isemail.test(email)){ alert("不是邮箱"); return false; } }
The above is the detailed content of A way to write js email verification method. For more information, please follow other related articles on the PHP Chinese website!