日期:2014-05-16 浏览次数:20658 次
function mailbox(strEmail){confirm()
var xmlHttp;
try
{
// Firefox, Opera 8.0+, Safari
xmlHttp=new XMLHttpRequest();
}
catch (e)
{
// Internet Explorer
try
{
xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e)
{
try
{
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
}
catch (e)
{
alert("您的浏览器不支持AJAX!");
return false;
}
}
}
xmlHttp.onreadystatechange=function()
{
var xx = document.getElementsByName("name_mailbox")[0].value;
if (xx == ""){document.getElementById("mailbox_msg").innerHTML='<div><font color=red>邮箱不能为空!</font></div>';}
else if(strEmail.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) != -1) {//就是这里 要怎么修改
if(xmlHttp.readyState==4)
{
var x = xmlHttp.responseText;//获取传过来的值
if(x == 1)
{
ee = "1";
document.getElementById("mailbox_msg").innerHTML='<div><font color=green>邮箱可以使用!</font></div>';}
else
{document.getElementById("mailbox_msg").innerHTML='<div><font color=red>邮箱已经被注册</font></div>';}
}
}
else{document.getElementById("mailbox_msg").innerHTML='<div><font color=red>邮箱地址不正确</font></div>';}
}
var name=document.myForm.name_mailbox.value;
xmlHttp.open("get","mail.php?youx="+name,true);
xmlHttp.send(null);
}