Welcome to WebmasterWorld Guest from

Forum Moderators: open

Message Too Old, No Replies

onChange event to change cell colour



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

10+ Year Member

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.



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

WebmasterWorld Senior Member 10+ Year Member

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';


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

10+ Year Member

Many thanks -- will give it a try.



Featured Threads

Hot Threads This Week

Hot Threads This Month