D4Ly
asked on
document.getElementById style Q
I have this javascript:
if (window.XMLHttpRequest) {
newLogoAsk = new XMLHttpRequest();
}
function getNewLogo() {
if (window.XMLHttpRequest) {
// branch for IE/Windows ActiveX version
} else if (window.ActiveXObject) {
newLogoAsk = new ActiveXObject("Microsoft.X MLHTTP");
}
newLogoAsk.onreadystatecha nge = newLogoChange;
newLogoAsk.open("GET", "/scripts/randomheader.php ");
newLogoAsk.send(null);
}
function newLogoChange() {
if (newLogoAsk.readyState == 4) {
var imG = newLogoAsk.responseText;
document.getElementById("l ogo").styl e.backgrou nd = 'url(../img/headers/'+imG+ ') no-repeat left top';
}else{
document.getElementById("l ogo").styl e.backgrou nd = 'url(../img/header_loading .jpg) no-repeat left top';
}
}
which applies a new background style to "logo" in this code:
<div id="logo">
<div id="shadow">
<div id="nextimg">
<a href="javascript://" title="New Header!" onclick="getNewLogo()"><im g id="photonext" src="img/header_button.gif " alt="New Header!"/></a>
</div>
</div>
</div>
so, everything here works wonderfully, IN FF. NOT in IE. I get the response back from the server, and everything is great, only:
document.getElementById("l ogo").styl e.backgrou nd
doesn't seem to be working in IE!! Is there a solution???
if (window.XMLHttpRequest) {
newLogoAsk = new XMLHttpRequest();
}
function getNewLogo() {
if (window.XMLHttpRequest) {
// branch for IE/Windows ActiveX version
} else if (window.ActiveXObject) {
newLogoAsk = new ActiveXObject("Microsoft.X
}
newLogoAsk.onreadystatecha
newLogoAsk.open("GET", "/scripts/randomheader.php
newLogoAsk.send(null);
}
function newLogoChange() {
if (newLogoAsk.readyState == 4) {
var imG = newLogoAsk.responseText;
document.getElementById("l
}else{
document.getElementById("l
}
}
which applies a new background style to "logo" in this code:
<div id="logo">
<div id="shadow">
<div id="nextimg">
<a href="javascript://" title="New Header!" onclick="getNewLogo()"><im
</div>
</div>
</div>
so, everything here works wonderfully, IN FF. NOT in IE. I get the response back from the server, and everything is great, only:
document.getElementById("l
doesn't seem to be working in IE!! Is there a solution???
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I have sent you an alternative solution in the other question - Did the comment above help you solve this question?
Batalf
Batalf
ASKER
yes it did! I'm using the first approach with the \' for quotes.
That's good - Glad I could help
Batalf
Batalf
ASKER
If you're looking for a few more points, I'm having trouble with the javascript m8trix wrote here:
https://www.experts-exchange.com/questions/21418238/Live-Mail-Form.html
He stopped responding, and I am still in need of a solution!!