PDA

View Full Version : how to change background image on firefox


jasongr
01-25-2005, 11:13 AM
Hello

I have the following table definition:

<table border="0">
<tr>
<td id="test" style="background-image: url('one.gif');">hello</td>
</tr>
</table>

I would like to change the background image of that cell in runtime via JavaScript on Firefox 1.0. I tried the following but it didn't work

var obj = document.getElementById("test");
obj.style.backgroundImage = 'two.gif';

can anyone tell me what I am doing wrong, and how to fix it?

regards

coothead
01-25-2005, 12:08 PM
Hi there jasongr,

without seeing your complete script I am unable to test.
Nevertheless try changing this...
obj.style.backgroundImage = 'two.gif';
...to this...
obj.style.backgroundImage = 'url(two.gif)';

jasongr
01-25-2005, 12:11 PM
thanks, your solution indeed worked