function request() ...{ var A=null; try ...{ A=new ActiveXObject("Msxml2.XMLHTTP"); } catch(e) ...{ try ...{ A=new ActiveXObject("Microsoft.XMLHTTP"); } catch(oc) ...{ A=null; } } if ( !A && typeof XMLHttpRequest != "undefined" ) ...{ A=new XMLHttpRequest(); } return A; } 上面这一段代码在IE和Firefox下都可以使用,创建一个 XMLHttpRequest