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

 1 None.gif //  检查 E-mail 是否已被注册
 2 None.gif      function  CheckExists()
 3 ExpandedBlockStart.gifContractedBlock.gif     dot.gif {
 4InBlock.gif        var e = document.getElementById("mailaddress").value;
 5ExpandedSubBlockStart.gifContractedSubBlock.gif        if(e != ""dot.gif{
 6ExpandedSubBlockStart.gifContractedSubBlock.gif            if(!/(\S)+[@]dot.gif{ 1}(\S)+[.]dot.gif{ 1}(\w)+/.test(e)) 
 7ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif{
 8InBlock.gif                alert("请输入格式正确的 e-mail 地址!");
 9InBlock.gif                var email = document.getElementById ( "mailaddress" );
10InBlock.gif                email.value = "";
11InBlock.gif                email.focus ();
12ExpandedSubBlockEnd.gif            }
 
13InBlock.gif            else 
14ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif{
15InBlock.gif                QuickRegisterBox.IsEMailExists(e, CheckExists_Callback);
16ExpandedSubBlockEnd.gif            }

17ExpandedSubBlockEnd.gif        }

18ExpandedBlockEnd.gif    }

你可能感兴趣的:(javascript)