chiprivers Posted November 19, 2007 Share Posted November 19, 2007 Can somebody help me with a function that I can put in the onChange of a checkbox in a form that will change the colour of the table cell that the box is in so that it is coloured when the box is checked and blank when unchecked. Quote Link to comment Share on other sites More sharing options...
~n[EO]n~ Posted November 19, 2007 Share Posted November 19, 2007 This might help http://www.diplok.com/1ppl/html/article040.html Quote Link to comment Share on other sites More sharing options...
emehrkay Posted November 19, 2007 Share Posted November 19, 2007 assuming that the parent element of the checkbox is the cell, you can try something like this function highlightCell(ele_id){ var ele = document.getElementById(ele_id); var ele_parent = ele.parentNode; var off = '#ccc', on = '#f00'; ele_parent.style.background = (ele_parent.style.background == on) ? off : on; } Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.