homepage Welcome to WebmasterWorld Guest from 50.17.134.177
register, login, search, subscribe, help, library, PubCon, announcements, recent posts, open posts,
Pubcon Platinum Sponsor
Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
Forum Library : Charter : Moderators: whoisgregg

JavaScript and AJAX Forum

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




msg:1483961
 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




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

How is the number found in that other cell generated?

moonbiter




msg:1483963
 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




msg:1483964
 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.
Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About
WebmasterWorld ® and PubCon ® are a Registered Trademarks of Pubcon Inc.
© Pubcon Inc. 1996-2012 all rights reserved