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
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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.