Welcome to WebmasterWorld Guest from 54.242.134.77

Forum Moderators: open

Message Too Old, No Replies

Backgroundimage of Cell

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

     

EvilPenguin

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

10+ Year Member



Hi
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)

Thanx

Sinner_G

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?

moonbiter

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

or

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

EvilPenguin

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

10+ Year Member



It worked,
thx
 

Featured Threads

Hot Threads This Week

Hot Threads This Month