用javascript的正则表达式来验证Email地址是否格式正确


1// 检查 E-mail 是否已被注册
 2    function CheckExists()
 3    {
 4        var e = document.getElementById("mailaddress").value;
 5        if(e != "") {
 6            if(!/(\S)+[@]{1}(\S)+[.]{1}(\w)+/.test(e))
 7            {
 8                alert("请输入格式正确的 e-mail 地址!");
 9                var email = document.getElementById ( "mailaddress" );
10                email.value = "";
11                email.focus ();
12            }
13            else
14            {
15                QuickRegisterBox.IsEMailExists(e, CheckExists_Callback);
16            }
17        }
18    } 本文作者:
« 
» 
快速导航

Copyright © 2016 phpStudy | 豫ICP备2021030365号-3