Javascript电子邮件验证
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Javascript电子邮件验证相关的知识,希望对你有一定的参考价值。
function validateForm (submit) { var errmsg = "Oops, you're required to complete the following fields! "; if (submit.email.value.search(/^w+((-w+)|(.w+))*@[A-Za-z0-9]+((.|-)[A-Za-z0-9]+)*.[A-Za-z0-9]+$/) == -1) { errmsg = errmsg + " - Valid email "; } //Validate other form fields, etc, etc. if (submit.name.value=="") { errmsg = errmsg + " - Full Name "; } //alert if fields are empty and cancel form submit if (errmsg == "Oops, you're required to complete the following fields! ") { sub.submit(); } else { alert(errmsg); return false; }
以上是关于Javascript电子邮件验证的主要内容,如果未能解决你的问题,请参考以下文章
我正在尝试使用javascript进行表单验证,但电子邮件验证不起作用