admin管理员组

文章数量:1635004

<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>&nbsp;</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