homepage Welcome to WebmasterWorld Guest from 54.198.140.182
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
Forum Library, Charter, Moderator: open

JavaScript and AJAX Forum

    
onChange event to change cell colour
Gandalf618




msg:1474143
 9:34 pm on Aug 7, 2003 (gmt 0)

Hi All

I have an application where i wish to change a cell's bg colour when the value of a form text field changes. I'm guessing that the onCHANGE event will be used but then I'm not sure how I reference the particular table cell I wish to change the bg colour value for.

Any suggestions/example code would be much appreciated.

Gandalf

 

moltar




msg:1474144
 9:41 pm on Aug 7, 2003 (gmt 0)

you should assign an id to you table cell:

<td id="id_name"></td>

then you can use the follwoing js code:

document.getElementById('id_name').style.backgroundColor = 'red';

Gandalf618




msg:1474145
 9:52 pm on Aug 7, 2003 (gmt 0)

Many thanks -- will give it a try.

Gandalf

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