Der PHP Code ist im zusammenhang mit JS uninteressant.
ich krieg knapp 500.000 Ergebnisse wenn ich in google nach "javascript tabellenzeile markieren" suche.
Hmm, wobei die aber nicht hilfreich sind.
Ich würd's so machen:
Der Event:
Code:
<input type="checkbox" onclick="markRow(this)">
Die JS Funktion:
PHP-Code:
function markRow(el) {
if(!el) return;
var clr = el.checked ? '#f00' : ''
while(el) {
if(el.tagName.toLowerCase() == 'tr') {
el.style.backgroundColor = clr;
return;
}
el = el.parentNode;
}
}