CopyCode The Code is as follows: <SCRIPT type = "text/JavaScript"> <! --
VaR request = false;
Try {
Request = new XMLHttpRequest ();
} Catch (trymicrosoft ){
Try {
Request = new activexobject ("msxml2.xmlhttp ");
} Catch (othermicrosoft ){
Try {
Request = new activexobject ("Microsoft. XMLHTTP ");
} Catch (failed ){
Request = false;
}
}
}
If (! Request) Alert ("error initializing XMLHttpRequest! ");
// Obtain information
Function getinfo (){
VaR url = "test. aspx? Username = "+ document. getelementbyid (" txtname "). value;
Request. Open ("get", URL, true );
Request. onreadystatechange = updatepagetime;
Request. Send (null );
}
// Update page
Function updatepagetime (){
If (request. readystate = 4 ){
If (request. Status = 200 ){
VaR response = request. responsetext;
Document. getelementbyid ("txtloginname"). value = response;
} Else if (request. Status = 404 ){
Alert ("requested URL is not found .");
} Else if (request. Status = 403 ){
Alert ("Access denied .");
} Else
Alert ("status is" + request. status );
}
}
// --> </SCRIPT>
<Form ID = "form1" runat = "server">
<Input id = "txtname" onchange = "getinfo ()" type = "text"/>
<Input id = "txtloginname" type = "text"/>
</Form>