<!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd">
<html xmlns="http://www.111cn.net/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=gb2312" />
<title>电子邮箱验证函数</title>
<script language="javascript教程">
if (document.form.email.value==""){
alert("email地址不能为空!");
form.email.focus();
return false;
}
if(!/w+@w+(.w+)+/ig.test(document.form.email.value)){
alert('请正确填写email格式!^_^');
form.email.focus();
return false;
}
</script>
</head>
<body>
</body>
</html>
方法二
function isemail(str)
{
var reg=/^w+([-+.]w+)*@w+([-.]w+)*.w+([-.]w+)*$/; 或者是
var myreg = /^[-_a-za-z0-9.]+@([_a-za-z0-9]+.)+[a-za-z0-9]{2,3}$/;
return reg.test(str);
}