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. Link to comment https://forums.phpfreaks.com/topic/77903-form-table-cell-background-colour-change/ 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 Link to comment https://forums.phpfreaks.com/topic/77903-form-table-cell-background-colour-change/#findComment-394342 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; } Link to comment https://forums.phpfreaks.com/topic/77903-form-table-cell-background-colour-change/#findComment-394576 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.