第一种
<script language="javascript">
function chk(objEmail){
if(!/^\w+@\w+(\.\w+){1,3}$/.test(objEmail.value)){
alert('error email !');
objEmail.focus();
return false
}
return true
}
</script>
<form name="form1" onsubmit="return chk(uEmail)">
Your Email : <input id="uEmail" name="uEmail" style="width:200px" />
<input type="submit" value="提交" />
</form>
第二种是正则表达
//Email;
function isEmail(s){
s = trim(s);
var p = /^[_\.0-9a-z-]+@([0-9a-z][0-9a-z-]+\.){1,4}[a-z]{2,3}$/i;
return p.test(s);
}
中国足彩网信息请查看IT技术专栏