//得到XMLHttpRequest对象 var xmlhttp = null; function getxmlhttp() { if (window.ActiveXObject) { try { xmlhttp=new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } } else if (window.XMLHttpRequest) { xmlhttp=new XMLHttpRequest(); } return xmlhttp; } function getxml(x) { getxmlhttp();//先给xmlhttp赋值 if (xmlhttp!=null) { xmlhttp.open("GET",x,false); xmlhttp.send(null); } else { alert("Your browser does not support XMLHTTP.11"); return false; } return(xmlhttp); } function loadxmldoc(x) { var xmlDoc; if (window.ActiveXObject) { xmlDoc = new ActiveXObject("Microsoft.XMLDOM"); xmlDoc.async=false; xmlDoc.load(x); } else if (window.XMLHttpRequest) { xmlDoc = getxml(x).responseXML; } else { return false; } return xmlDoc; }