Welcome to WebmasterWorld Guest from 54.144.107.83

Forum Moderators: open

Message Too Old, No Replies

onChange event to change cell colour

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

New User

10+ Year Member

joined:Aug 7, 2003
posts:2
votes: 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

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

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:June 18, 2003
posts:1925
votes: 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';
9:52 pm on Aug 7, 2003 (gmt 0)

New User

10+ Year Member

joined:Aug 7, 2003
posts:2
votes: 0


Many thanks -- will give it a try.

Gandalf

 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members