Click to See Complete Forum and Search --> : new ActiveXObject (not creating the object)


puffin
10-03-2005, 05:20 AM
Hi all,

I use new ActiveXObject as to read the XML file. I tried this is FIrefox and it works fine, but not in IE.

function readXML(url){
if (window.XMLHttpRequest) {
req = new XMLHttpRequest();
req.overrideMimeType ("text/xml");
alert("the req is " + req);
req.onreadystatechange = processReqChange;
req.open("GET", url, true);
req.send(null);
} else if (window.ActiveXObject) {
req = new ActiveXObject("Microsoft.XMLHTTP");
alert("The req is " + req); // nothing showing up to represent the req
if (req) {
req.onreadystatechange = processReqChange;
req.open("GET", url, true);
req.send();
}
}
}

In firefox, it shows "the req is [object XMLHTTPRequest], but in IE, it shows "The req is " (blank for req). Then when I continue the code as follow:

var desc = xmlDocument.getElementsByTagName('desc')[0].firstChild.nodeValue;

There is an error popping out: Object Required.

Can anyone give me some advice as I haven't a clue what happen here?

Thanks in advance,
P.