在JS中使用正则表达式验证电子邮箱是否正确

 

 1 <script language="javascript">
 2 function isEmail(strEmail) {
 3   if (strEmail.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/!= -1)
 4    return true;
 5   else
 6    alert("Email格式不正确!");
 7    document.formSignUp.email.value="";
 8    document.formSignUp.email.focus();
 9  }
10 </script>
11 
posted @ 2007-07-26 09:32  Tony_YANG  阅读(1665)  评论(0编辑  收藏  举报