<script language="javascript" type="text/javascript">
function checkEmail() {
var email=document.form.email.value;
if(email.length==0){
alert("不能为空!");
return false;
} else if(email.indexOf("@",0)==-1){
alert("邮件格式不对!/n缺少@符号!");
return false;
} else if(email.indexOf(".",0)==-1){
alert("邮件格式不对!/n缺少.符号!");
return false;
} else{
alert("OK");
}
/*
if(email.indexOf("@",0)==-1){
alert("邮件格式不对!/n缺少@符号!");
return false;
}
if(email.indexOf(".",0)==-1){
alert("邮件格式不对!/n缺少.符号!");
return false;
}
return true;
alert("OK");
*/
}
</script>
</head>
<body>
<form name="form" action="" method="post" οnsubmit="checkEmail()">
<input id="email" name="email" type="text" /><input id="ok" name="ok" type="submit" value="认证" />
</form>
</body>