xinzheng 发表于 2008-6-18 13:09

为什么这句话对firefox不起作用,该怎么改?使得ie和ff都起作用?

function GetData(URL) {
var http = new ActiveXObject("MSXML2.XMLHTTP.3.0");
http.open("GET",URL,false);
http.send(null);
document.getElementById("nr").innerHTML= http.responseText;
}

yms123 发表于 2008-6-18 13:12

firefox好像没有MSXML2.XMLHTTP.3.0这个组件

hmhz 发表于 2008-6-18 13:26

function GetData(URL) {
var http = false;
try {http = new ActiveXObject("Msxml2.XMLHTTP");}
catch (e) {try {http = new ActiveXObject("Microsoft.XMLHTTP");}
catch (e2) {http = false;}}
if (!http && typeof XMLHttpRequest != 'undefined') {http = new XMLHttpRequest();}
http.open("GET",URL,false);
http.send(null);
document.getElementById("nr").innerHTML=http.responseText;
}

xinzheng 发表于 2008-6-18 13:28

是的,可是不知道具体怎么用!!
这里有篇文章,谁能帮我看看我的问题!谢谢

http://www.5bay.cn/blog/read.php/266.htm

xinzheng 发表于 2008-6-18 13:31

[quote][bo][un]hmhz[/un] 在 2008-6-18 13:26 的发言:[/bo]

function GetData(URL) {
var http = false;
try {http = new ActiveXObject("Msxml2.XMLHTTP");}
catch (e) {try {http = new ActiveXObject("Microsoft.XMLHTTP");}
catch (e2) {http = false;}}
if (!htt ... [/quote]


十分感谢!!现在自己去找ie和ff对div显示不同的头痛问题去了!!!

页: [1]

编程论坛