//創(chuàng)建xmlhttp。此寫法兼容firefox2,firefox3和ie。
function createXMLHTTP() {
var xmlhttp = null;
if(window.ActiveXObject) {
try {xmlhttp=new ActiveXObject("Msxml2.XMLHTTP");}
catch(e){try{xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");}
catch(e){}}
} else if(window.XMLHttpRequest) {
xmlhttp = new XMLHttpRequest();
if(xmlhttp.overrideMimeType) {
xmlhttp.overrideMimeType('text/xml');
}
} else {alert("Create XMLHttpRequest object false!");return false;}
return xmlhttp;
}
調(diào)用處寫法: