04-21-2009, 10:37 PM
|
#9 (permalink)
|
|
The Gregarious
Join Date: Feb 2009
Location: New York
Posts: 645
Thanks: 64
|
I changed the code a little bit, but it doesn't work for me?
Code:
<script type="text/javascript">
var color_on = '#EEEEEE';
var color_off = '#FFFFFF';
function row_color(pTarget)
{
var pTR = pTarget.parentNode.parentNode;
if(pTR.nodeName.toLowerCase() != 'tr')
{
return;
}
if(pTarget.checked == true)
{
pTR.style.backgroundColor = color_on;
}
else
{
pTR.style.backgroundColor = color_off;
}
}
</script>
Code:
<table width="796" border="1" cellspacing="5" cellpadding="2">
<tr>
<td width="50"><label>
<div align="center">
<input type="checkbox" onclick="row_color(this)" id="checkbox" name="checkbox" />
</div>
</label></td>
<td width="717">whatever01</td>
</tr>
<tr>
<td><div align="center">
<input type="checkbox" onclick="row_color(this)" id="checkbox" name="checkbox" />
</div></td>
<td>whatever02</td>
</tr>
<tr>
<td><div align="center">
<input type="checkbox" onclick="row_color(this)" id="checkbox" name="checkbox" />
</div></td>
<td>whatever03</td>
</tr>
</table>
|
|
|
|