熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> Java編程 >> Javascript >> 正文

用Javascript驗證email填寫是否正確

2013-11-23 17:58:34  來源: Javascript 

  <html>
<head>
<title>test</title>
<script language=javascript>
function emailCheck () {
var emailStr=documentallformtelvalue;
alert(emailStr);
var emailPat=/^(+)@(+)$/;
var matchArray=emailStrmatch(emailPat);
if (matchArray==null) {
 alert(電子郵件地址必須包括 ( @ 和 ))
 return false;
}
return true;
}
</script>
</head>

  <body>
<form name=form>
<input type=text name=tel/>
<input type=button value=press onclick=emailCheck()/>
</form>

  </span>
</body>
</html>


From:http://tw.wingwit.com/Article/program/Java/Javascript/201311/25465.html
    推薦文章
    Copyright © 2005-2013 電腦知識網 Computer Knowledge   All rights reserved.