javascript验证email

testfunctionemailCheck(){varemailStr=document.JavaScript
强烈推介IDEA2020.2破解激活,IntelliJ IDEA 注册码,2020.2 IDEA 激活码

<html>
<head>
<title>test</title>
<script language="javascript">
function emailCheck () {
var emailStr=document.all.form1.tel.value;
alert(emailStr);
var emailPat=/^(.+)@(.+)$/;
var matchArray=emailStr.match(emailPat);
if (matchArray==null) {
 alert("电子邮件地址必须包括 ( @ 和 . )")
 return false;
}
return true;
}
</script>
</head>

<body>
<form name="form1">
<input type="text" name="tel"/>
<input type="button" value="press" οnclick="emailCheck()"/>
</form>

</span>
</body>
</html>

本文来源21aspnet,由架构君转载发布,观点不代表Java架构师必看的立场,转载请标明来源出处:https://javajgs.com/archives/3318

发表评论