Function createxmlhttprequestobject ()
{
If (window. XMLHttpRequest)
{Xmlhttp_request = new XMLHttpRequest ();}
Else
{Var MSXML = ['msxml2. xmlhttp.5.0 ', 'msxml2. xmlhttp.4.0', 'msxml2. xmlhttp.3.0 ', 'msxml2. xmlhttp', 'Microsoft. xmlhttp'];
For (VAR n = 0; n <MSXML. length; n ++)
{
Try
{
Xmlhttp_request = new activexobject (MSXML [N]);
Break;
}
Catch (e ){}
}
}
}
Or
Function createxmlhttp ()
{
VaR oxmlhttp = NULL;
If (window. activexobject) // IE
{
Try {oxmlhttp = new activexobject ("msxml2.xmlhttp ");}
Catch (e) {try {oxmlhttp = new activexobject ("Microsoft. XMLHTTP");} catch (e ){}}
}
Else
{
If (window. XMLHttpRequest) // Mozilla, Safari,
{
Oxmlhttp = new XMLHttpRequest ();
If (oxmlhttp. overridemimetype)
{
Oxmlhttp. overridemimetype ('text/xml ');
}
}
}
If (! Oxmlhttp)
{
Alert ('error: Unable to create XMLHTTP instance ');
}
Return oxmlhttp;
}