if(typeof ActiveXObject != "undefined")
{
var version = ['Msxml2.XMLHTTP.6.0','Msxml2.XMLHTTP.5.0','Msxml2.XMLHTTP.3.0','Msxml2.XMLHTTP','Microsoft.XMLHTTP'];
for(var i=0;i<=version.length;i++)
{
try
{
var obj = new ActiveXObject(version[i]);
if(typeof obj != "undefined")
{
break;
}
}
catch(ex)
{
}
}
}
else
{
var obj = new XMLHttpRequest();
}
alert(obj);
如果ActiveXObject的类型!=未定义的,那么这个else判断的是ActiveXObject=未定义?
为什么出现两次判断undefined?
if(typeof ActiveXObject != "undefined")
if(typeof obj != "undefined")