function GetXmlHttpObj( )
{
var xmlHttpObj = null; try{ xmlHttpObj = new ActiveXObject("Msxml2.XMLHTTP"); }
catch (e)
{
try{ xmlHttpObj = new ActiveXObject("Microsoft.XMLHTTP"); }
catch(e){ xmlHttpObj = null; }
}
if( !xmlHttpObj && (typeof XMLHttpRequest != "undefined") )
xmlHttpObj = new XMLHttpRequest();
return xmlHttpObj;
}
http://blog.csdn.net/lifeng_beijing/archive/2007/12/28/1998987.aspx