homepage Welcome to WebmasterWorld Guest from 54.145.183.169
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
Forum Library, Charter, Moderator: open

JavaScript and AJAX Forum

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

10+ Year Member



 
Msg#: 161 posted 12:53 pm on Jul 19, 2002 (gmt 0)

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

WebmasterWorld Senior Member 10+ Year Member



 
Msg#: 161 posted 12:58 pm on Jul 19, 2002 (gmt 0)

How is the number found in that other cell generated?

moonbiter

10+ Year Member



 
Msg#: 161 posted 2:52 pm on Jul 19, 2002 (gmt 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

10+ Year Member



 
Msg#: 161 posted 9:24 am on Jul 22, 2002 (gmt 0)

It worked,
thx

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved