28,391
社区成员
发帖
与我相关
我的任务
分享
if (this.frmreg.username.value!="")
{
if (this.frmreg.emailname.value!="")
{
username=this.frmreg.username.value+"@"+this.frmreg.emailname.value;
var xmlhttp;
try
{
xmlhttp=new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e)
{
try
{
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
catch (e)
{
try
{
xmlhttp=new XMLHttpRequest();
}
catch (e)
{
}
}
}
//创建请求,并使用escape对username编码,以避免乱码
xmlhttp.open("get","checkuser.asp?username="+escape(username));
xmlhttp.onreadystatechange=function()
{
if(4==xmlhttp.readyState)
{
if(200==xmlhttp.status)
{
if (xmlhttp.responseText=="yes")
{
msg="此用户名已经存在";
color="red";
}
else
{
msg="此用户名可以注册";
color="#009900";
}
}
else
{
msg="网络链接失败";
}
var ch=document.getElementById("checkuser");
ch.innerHTML="<font color="+color+">"+msg+"</font>";
}
}
xmlhttp.send(null);
//return false;
}
}
set rs = Server.CreateObject("ADODB.Recordset")
strsql="select * from users where username='"&request("username")&"'"
rs.open strsql,cnn,1,1
if not rs.eof then response.Write "yes"
response.End()
rs.close
set rs=nothing
set cnn=nothing