Copy code code as follows:
var xmlHttp;
UName ()//user name loses focus
{
if (all.uname.==)
{
All.l1.innerhtml= ' cannot be empty! ";
SetTimeout ("Close (1)", 1500);
return;
}
Else
{
xmlhttp=new activexobject ("Microsoft.XMLHTTP");
Xmlhttp.onreadystatechange=deal//callback function
var url= "ajax.aspx?user=" +all.uname.+ "";//the page that is going to detect the user name
Xmlhttp.open ("Get", url,true); Submits the form to the URL in get mode, and initiates a step to process
Xmlhttp.send (null);//Send
}
}
Deal ()
{
//alert (XMLHTTP.R eadystate+ "__" +xmlhttp.status);
if (xmlhttp.readystate!=4)
{return;}
if (xmlhttp.status!=200)//equals 500 is an error of the SQL statement or database
{return;}
//
var num = xmlhttp.responsetext;///Receive server send information
//alert (num);
all.l1.innertext= ""; The
if (num>0)
{
all.l1.innertext= ' secondary username is already in use! ";
}
Else
{
all.l1.innertext= "√";
}
}