Jump to content

changing background image in IE


phpknight

Recommended Posts

I'm changing the background image with javascript.  This works fine in Firefox, but IE doesn't change anything.  I've tried multiple formats for the url.  I also changed the code so that it changed the background-color instead.  That worked.  Is there anything special I have to do to get IE to change the background-image? 

Link to comment
https://forums.phpfreaks.com/topic/168700-changing-background-image-in-ie/
Share on other sites

In the html, I have a div:

<div id='VpcCanvas' style='background-image:url(blank.png);'>
</div>

 

Then when you click a button, it is supposed to just switch it to blank2.png.

document.getElementById('VpcCanvas').style.backgroundImage=responseText2; //this is blank2.png

 

One image is a slash, and the other is an X.  So, when you click, one slash becomes an X>

 

Everything works just fine in Firefox.  I've tried url with no quotes, double-quotes, and single quotes.  I've also tried full paths.  No luck in IE.  If I get rid of the background image and do a background color changing with white to blue, it works.

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.