Welcome to WebmasterWorld Guest from

Forum Moderators: open

Message Too Old, No Replies

Backgroundimage of Cell

I want to change the background image of a cell using JS



12:53 pm on Jul 19, 2002 (gmt 0)

I've got the following problem : I want to change the background image of a cell depending on a number which is found in another cell. I hope that you can help me. (No problems with the if statements, I just dont know how to get the data from the cell and how to change the background image)



12:58 pm on Jul 19, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member

How is the number found in that other cell generated?


2:52 pm on Jul 19, 2002 (gmt 0)

10+ Year Member

To access the contents of a cell:

document.getElementById('cellID').innerHTML; //W3C DOM

document.all['cellID'].innerHTML; //MS DHTML

To change the background of a cell:

document.getElementById('cellID').style.backgroundImage = 'url(http://image.url)' //W3C DOM

document.all['cellID'].style.backgroundImage = 'url(http://image.url)' //MS DHTML using CSS


document.all['cellID'].background = 'http://image.url' //MS DHTML using background attribute


9:24 am on Jul 22, 2002 (gmt 0)

It worked,

Featured Threads

Hot Threads This Week

Hot Threads This Month