/    Sign up×
Community /Pin to ProfileBookmark

Newbie question: IE problem w/ <div> switching

?
My webpage: [url]http://www.jpsaos.com/geis[/url]

Can anybody tell me why the buttons on the left can switch the content in my <div> box on Safari but not IE?

This is my function for the switch…

function jah(url,target) {
// native XMLHttpRequest object
document.getElementById(target).innerHTML = ‘sending…’;
if (window.XMLHttpRequest) {
req = new XMLHttpRequest();
req.onreadystatechange = function() {jahDone(target);};
req.open(“GET”, url, true);
req.send(null);
// IE/Windows ActiveX version
} else if (window.ActiveXObject) {
req = new ActiveXObject(“Microsoft.XMLHTTP”);
if (req) {
req.onreadystatechange = function() {jahDone(target);};
req.open(“GET”, url, true);
req.send();
}
}
}

function jahDone(target) {
// only if req is “loaded”
if (req.readyState == 4) {
// only if “OK”
if (req.status == 200) {
results = req.responseText;
document.getElementById(target).innerHTML = results;
} else {
document.getElementById(target).innerHTML=”jah error:n” +
req.statusText;
}
}
}

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@cgishackJul 30.2008 — try adding a click event to the button instead of:

<a href="javascript:jah('funstuff.htm','switch');">

maybe something like

<a href="#" onclick="jah('funstuff.htm','switch');"> Click Me </a>

it could be an ajax issue also. Alert your req.responseText to make sure its getting that far
Copy linkTweet thisAlerts:
@nitewaterauthorJul 30.2008 — i coulda sworn i tried it that way too... it worked with just that fix... thanks.
×

Success!

Help @nitewater spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.3,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...