Jump to content

I wish I could blow up IE.. need some help


vincea

Recommended Posts

Ok well this is a basic script.. but won't work in IE. Works in Opera, Navigator, Firefox but not in IE.. of course.

Basically all it does is load a .php file when the link is clicked making Ajax show the .php file in a <div>

BUT IE refuses to co-operate with the text link command, I have tried different variants and still nothing. It is IE 6.

the code....

The menu link in the body of the page which submits the php file and the div ID
[code]<li><a href="#" onClick="getData('member.php?mem=mike', 'contentContainer')">&raquo; Mike</a></li>[/code]


and here is the basic XMLHttpRequest object in the head..
[code]
var XMLHttpRequestObject = false;

if (window.XMLHttpRequest) {
XMLHttpRequestObject = new XMLHttpRequest();
} else if (window.ActiveXObject) {
HttpRequestObject = new ActiveXObject("Microsoft.XMLHTTP");
}

function getData(dataSource, divID) {

if (XMLHttpRequestObject) {
var obj = document.getElementById(divID);
XMLHttpRequestObject.open("GET", dataSource);

XMLHttpRequestObject.onreadystatechange = function() {
if (XMLHttpRequestObject.readyState == 1) {
obj.innerHTML = "<div id='load'>Loading.. <img src='spinner.gif'></div>";
initLightbox();
}
if (XMLHttpRequestObject.readyState == 4 && XMLHttpRequestObject.status == 200) {
obj.innerHTML = XMLHttpRequestObject.responseText;
}
}
XMLHttpRequestObject.send(null);
}
}
[/code]

Any help would be great...
Vince
Link to comment
https://forums.phpfreaks.com/topic/24469-i-wish-i-could-blow-up-ie-need-some-help/
Share on other sites

Umm... you're naming the object 2 different things.
[code]if (window.XMLHttpRequest) {
XMLHttpRequestObject = new XMLHttpRequest();
} else if (window.ActiveXObject) {
XMLHttpRequestObject = new ActiveXObject("Microsoft.XMLHTTP");
}[/code]

Try that.  That would be why IE isn't working, because you're never doing anything with IE's object.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.