metti di avere la tabella con id = "MyTable", metti questo script:
Dovrebbe andare.codice:var rows; var colorClick = '#ffff66', colorUnclick = '#FFF'; window.onload = function(){ var tab = document.getElementById('MyTable'); rows = tab.getElementsByTagName('tr'); for(i = 0; i < rows.length; i++) { rows[i].onclick = function(){ for(j = 0; j < rows.length; j++) { rows[j].style.backgroundColor = rows[j] == this ? colorClick : colorUnclick; } } } }
Per customizzarlo: colorClick è il colore che la riga cliccata prende, colorUnclick sono tutte le altre righe, modifichi la stringa "MyTable" in var tab = document.getElementById('MyTable'); con l'id della tua tabella per applicare l'effetto.

Rispondi quotando