Welcome to WebmasterWorld Guest from 50.16.126.107

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)

Inactive Member
Account Expired

 
 


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

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

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:June 27, 2002
posts:959
votes: 0


How is the number found in that other cell generated?
2:52 pm on July 19, 2002 (gmt 0)

Preferred Member

10+ Year Member

joined:May 1, 2002
posts:351
votes: 0


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 July 22, 2002 (gmt 0)

Inactive Member
Account Expired

 
 


It worked,
thx
 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members