谁能教我怎么用JS限制邮箱只能使用确定的地址
比如说只能使hotmail和gmail两个。

解决方案 »

  1.   

    hotmail.com和gmail.com是吧<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <script type="text/javascript" src="jquery-1.4.2.min.js"></script>
    <script type="text/javascript">
    function check(dom) {
    var reg = /^[\w.]+@(gmail|hotmail)\.com$/i;
    alert(reg.test(dom.value));
    }
    </script>
    </head><body>
    <input type="text" onblur="check(this)" /></body>
    </html>