Help - Search - Members - Calendar
Full Version: <TD> BackgroundImage change in IE and Mozila
HTMLHelp Forums > Web Authoring > General Web Design
lakshcreations
Hello Friends,

I need to change the background image of a cell dynamically .

i did use this

document.getElementById("background1").style.backgroundImage='url(Images/Red_background.gif)';

but its not working for IE. The problem is strange when i see in my local(offline) its working fine but when i use check the same online then its not working sad.gif I launched site on 010107 after that i came to know about this problem.

U can see my site lakshcreations

Friends pull me out from this problem. Its seems very easy but it becomes very length now.

I dont care about Opera and Safari. It shud run fine in NS, Mozila, Fire fox and IE.


Regards
Lakshcreations
Christian J
Strange, when I click the second thumbnail the innerHTML of MSIE does indicate that the background-image style has changed to "wb2.jpg", but you don't see the change on the screen. Might be a bug in IE.

Couple of long-shots: try specifying the default background in the embedded style sheet rather than using an inline style (in order to decrease specificity), or try preloading the background-images.

lakshcreations
Thanks Christian J for looking up my problem and for nice guidence. Do you have any similar example like i need, so i can visualize your idea.

can reply me frankly:)
lakshcreations
Hey Christian J

I have checked in IE 7. Its working fine. So This is IE's bug in version 6. M i right Christian J ?? Wats ur comment on this?
Christian J
Preloading seemed to work: change

CODE
<script type="text/javascript">

function changeback(val)

to

CODE
<script type="text/javascript">
var pic1=new Image; pic1.src='images/wb1.jpg';
var pic2=new Image; pic2.src='images/wb2.jpg';
var pic3=new Image; pic3.src='images/wb3.jpg';
var pic4=new Image; pic4.src='images/wb4.gif';
var pic5=new Image; pic5.src='images/wb5.gif';
var pic6=new Image; pic6.src='images/wb6.gif';

function changeback(val)

This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2010 Invision Power Services, Inc.