function checkEmail(){
var email = document.getElementById("email").value;
var a = email.indexOf("@");
var b = email.lastIndexOf(".");
if(a<1||(b-a)<2){
alert("Email填写有误!");
document.getElementById("email").focus();
}else{
document.getElementById("myForm").submit();
}
}
</script>
</head>
<body>
<form id="myForm" action="" method="post">
<p>Email:<input type="text" name="email" value="" id="email" /></p>
<p><input type="button" name="sub" value="submit" οnclick="checkEmail()"/></p>
</form>
</body>