Posted on 2007-07-10 09:17
冰江独行 阅读(4906)
评论(2) 编辑 收藏
<script language="javascript">
function CheckEmail(form){
var email = form.Email.value;
var pattern = /^([a-zA-Z0-9._-])+@([a-zA-Z0-9_-])+(\.[a-zA-Z0-9_-])+/;
flag = pattern.test(email);
if(!flag){
alert("email格式不正确!");
form.Email.focus();
return false;
}
return (true);
}
</script>
<form name="form1" onSubmit=" return false;">
请输入email:<input type="text" name="Email" value=""><input type="button" onClick="return CheckEmail(this.form);" value="验证">
</form>