Forum Moderators: open
Am having some trouble getting getElementById to work in Netscape 7. My code works fine in IE5.5 and IE6, but it keels over in Netscape 7 (and apparently NS6 too)!
I'm trying to get a table cell background image to change using getElementById to grab the reference to the cell:
document.getElementById(cell).background = 'someimage.gif' Any thoughts?
Try setting the background through the style property:
document.getElementById(cell).style.background = 'url(someimage.gif)'
This should set the CSS background style of your table cell. I remember from past experience that sometimes this sort of thing only works if it already had a value explicitly assigned, so you might need to start with this in your td tag:
<td style="background:url(nothing);">...stuff...</td>
Don't worry about the fact that there is no such file as "nothing", it won't cause any errors.