Function getXmlhttp ()
{
Var http_request;
If (window. XMLHttpRequest ){
Http_request = new XMLHttpRequest ();
If (http_request.overrideMimeType ){
Http_request.overrideMimeType ("text/xml ");
}
}
Else if (window. ActiveXObject ){
Try {
Http_request = new ActiveXObject ("Msxml2.XMLHTTP ");
} Catch (e ){
Try {
Http_request = new ActiveXObject ("Microsoft. XMLHTTP ");
} Catch (e ){}
}
}
If (! Http_request ){
Window. alert ("can't create XMLHttpRequest object .");
Return null;
}
Return http_request;
}
Function loadAJAXTab (url, contentid ){
Var ocontent = getElement (contentid );
If (ajccache [url] = null ){
Var xhttp = getXmlhttp ();
Xhttp. onreadystatechange = function (){
If (xhttp. readyState = 4 & (xhttp. status = 200 | window. location. href. indexOf ("http") =-1 ))
{
Ocontent. innerHTML = xhttp. responseText;
Ajccache [url] = ocontent. innerHTML;
}
}
Xhttp. open ("GET", url, true );
Xhttp. send (null );
} Else {
Ocontent. innerHTML = ajccache [url];
}
}
Window. onerror = function () {return true}
// Xml. js
Var xhr;
Function getXHR ()
{
Try {
Xhr = new ActiveXObject ("Msxml2.XMLHTTP ");
} Catch (e ){
Try {
Xhr = new ActiveXObject ("Microsoft. XMLHTTP ");
} Catch (e ){
Xh * = ** lse;
}
}
If (! Xhr & typeof XMLHttpRequest! = 'Undefined ')
{
Xhr = new XMLHttpRequest ();
}
Return xhr;
}
Function openXHR (method, url, callback)
{
GetXHR ();
Xhr. open (method, url );
Xhr. onreadystatechange = function ()
{
If (xhr. readyState! = 4) return;
Callback (xhr );
}
Xhr. send (null );
}
Function loadXML (method, url, callback)
{
GetXHR ();
Xhr. open (method, url );
Xhr. setRequestHeader ("Content-Type", "text/xml ");
Xhr. setRequestHeader ("Content-Type", "GBK ");
Xhr. onreadystatechange = function ()
{
If (xhr. readyState! = 4) return;
Callback (xhr. respon *** ML );
}
Xhr. send (null );
}
// ============================================================================
Function quote (xhr)
{
Alert (xhr. responseText );
Document. getElementById ("xml"). innerText = xhr. responseText;
}