I have a problem. I have an image set to the background, this method is working for fire fox, here is how i got a background image.

<img src="docs/Plasma.gif" id="background"/>

<div id="content">

Right after the body tag and

img#background { position:fixed;
#content {

In the styles. So, further down the page i have

img src="docs/JellyFishThumb.gif" height="50" width="75" onclick="document.background.src='docs/JellyFish.gif';"/>
 <br><img src="docs/StarFieldThumb.gif" onclick="document.background.src='docs/StarField.gif';" height="50" width="75"/>
 <br><img src="docs/PlasmaThumb.gif" onclick="document.background.src='docs/Plasma.gif';" height="50" width="75"/></center>

When someone clicks on these thumbnails it changes the backround image's source to the bigger version. It doesn't work in IE though and i am confused why. I have tried preloading the image, but I feel as though my Javascript is being ignored. Any help would be appreciated. Thank you.

Recommended Answers

All 2 Replies

background is a reserved word

Thanks for the help, but i got it to work by adding a name tag to the background image. I think IE was seeing document.background and thinking name, instead of id. So this is what i did.

<img src="docs/Plasma.gif" id="background" name="background"/>

and now it works! Thanks anyway!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.