function x()
{
var a=null;
try
{
a=new ActiveXObject(“Msxml2.XMLHTTP”);
}
catch(c)
{
try
{
a=new ActiveXObject(“Microsoft.XMLHTTP”);
}
catch(b)
{
a=null;
}
}
if(!a&&typeof XMLHttpRequest!=”undefined”)
{
a=new XMLHttpRequest();
}
return a;
}
这个实例化方法至少支持IE、Firefox、Opera和Safari,它的一大特色是用了try…catch…,而不是经常用的if…else…,这种方式是比较稳妥和有效的。
历史上的今天
- pandora+squeezebox - 2006
- 此次出游的照片 - 2006
0 responses so far ↓
There are no comments yet...Kick things off by filling out the form below.
Leave a Comment