admin管理员组文章数量:1634989
<HTML>
<head>
<meta charset="UTF-8">
<TITLE>电子邮件格式的验证</TITLE>
<script language = "JavaScript">
function checkEmail( ){
var strEmail=document.myform.txtEmail.value;
if (strEmail.length==0)
{
alert("电子邮件不能为空!");
return false;
}
if (strEmail.indexOf("@",0)==-1)
{
alert("电子邮件格式不正确\n必须包含@符号!");
return false;
}
if (strEmail.indexOf(".",0)==-1)
{
alert("电子邮件格式不正确\n必须包含.符号!");
return false;
}
return true;
}
</script>
</head>
<FORM name="myform" method="post" action="" onSubmit="return checkEmail( )">
<table border="0" align="center">
<tr>
<td>您的电子邮件</td>
<td colspan="2"><input name="txtEmail" type="text" id="txtEmail">*必填</td>
</tr>
<tr>
<td colspan="3" align="center"><p> </p>
<p>
<input name="clearButton" type="reset" id="clearButton" value=" 清 空 ">
<input name="registerButton" type="submit" id="registerButton" value=" 注 册 " >
</p>
</td>
</tr>
</table>
</FORM>
</HTML>
版权声明:本文标题:JS:判断输入的电子邮箱是否正确 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://m.elefans.com/xitong/1729200297a1189514.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论