Link to home
Start Free TrialLog in
Avatar of D4Ly
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.XMLHTTP");
      }
      newLogoAsk.onreadystatechange = newLogoChange;
      newLogoAsk.open("GET", "/scripts/randomheader.php");
      newLogoAsk.send(null);
}
function newLogoChange() {
      if (newLogoAsk.readyState == 4) {
            var imG = newLogoAsk.responseText;
            document.getElementById("logo").style.background = 'url(../img/headers/'+imG+') no-repeat left top';
      }else{
            document.getElementById("logo").style.background = '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()"><img 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("logo").style.background

doesn't seem to be working in IE!! Is there a solution???
ASKER CERTIFIED SOLUTION
Avatar of Batalf
Batalf
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of D4Ly
D4Ly

ASKER

THANKS!!!

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!!
I have sent you an alternative solution in the other question -  Did the comment above help you solve this question?

Batalf
Avatar of D4Ly

ASKER

yes it did! I'm using the first approach with the \' for quotes.
That's good - Glad I could help

Batalf