Jay wrote:
Hi !
I am writing a page that displays a list of records in a table. Each
row for each record. Each row has a checkbox associated with it. Does
anybody know how to highlight a row when I click on a checkbox in that
row and unhightlight it when I re-click that checkbox? (like in
"hotmail" and "yahoo" e-mail when u select a message to delete).
Any help would be appreciated !
Thank you in advance !
Jay
this works in IE6, Netscape 7.1, Firefox 0.8:
<script type="text/javascript">
var color1="#D2E9FF";
var color2="#99CCFF";
function changebkg(ckbox,rownum) {
if (ckbox.checked)
document.getElementById('row'+rownum).style.backgr ound=color1;
else
document.getElementById('row'+rownum).style.backgr ound=color2;
}
</script>
<table width=110 bgcolor="99CCFF" border=1>
<tr id="row0" name="row0">
<td width="10"><input type="checkbox" name="C1" value="ON"
onclick="changebkg(this,0)"> </td>
<td width="50"> </td>
<td width="50"> </td>
</tr>
<tr>
<tr id="row1" name="row1">
<td width="10"><input type="checkbox" name="C1" value="ON"
onclick="changebkg(this,1)"> </td>
<td width="50"> </td>
<td width="50"> </td>
</tr>
</table>
Mike