lindm
07-19-2008, 04:31 PM
Have a small anomaly which is driving me crazy.
The page is pretty much self-explaining...simply load in a browser or check: http://www.drlindmark.se/kevin/script.html
<head>
<style type="text/css" media="screen,print">
.checked {background-color: #F1F1F1;}
</style>
<script type="text/javascript">
function pl(name)
{
if (name.checked == true) {name.parentNode.parentNode.className = "checked";} else {name.parentNode.parentNode.className = "xxx";}
}
function plt(name)
{
if (name.checked == true) {name.parentNode.parentNode.parentNode.className = "checked";} else {name.parentNode.parentNode.parentNode.className = "xxx";}
}
</script>
</head>
<body>
<form name="form1" method="post" action="">
<table border="1" cellspacing="0" cellpadding="0" class="">
<tr>
<td width="355">Tableclass 1 - not checked and no class. Works fine.</td>
<td width="120"> </td>
<td width="120"> </td>
<td width="25">
<input type="checkbox" name="checkbox" id="checkbox" onclick="plt(this)"> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
</table>
<br>
<table border="1" cellspacing="0" cellpadding="0" class="checked">
<tr>
<td width="355">Tableclass 2 - checked and class set.</td>
<td width="120"> </td>
<td width="120"> </td>
<td width="25">
<input name="checkbox" type="checkbox" id="checkbox" onclick="plt(this)" checked> </td>
</tr>
<tr>
<td><strong>PROBLEM!</strong> Why does not the background change??</td>
<td> </td>
<td> </td>
<td> </td>
</tr>
</table>
<br>
<table border="1" cellspacing="0" cellpadding="0">
<tr class="">
<td width="355">Rowclass 1 - not checked and no class. Works fine.</td>
<td width="120"> </td>
<td width="120"> </td>
<td width="25">
<input type="checkbox" name="checkbox2" id="checkbox2" onclick="pl(this)"> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
</table>
<br>
<table border="1" cellspacing="0" cellpadding="0">
<tr class="checked">
<td width="355">Row class 2 - checked and class set. Works fine.</td>
<td width="120"> </td>
<td width="120"> </td>
<td width="25">
<input name="checkbox2" type="checkbox" id="checkbox2" onclick="pl(this)" checked> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
</table>
<br>
</form>
</body>
</html>
The page is pretty much self-explaining...simply load in a browser or check: http://www.drlindmark.se/kevin/script.html
<head>
<style type="text/css" media="screen,print">
.checked {background-color: #F1F1F1;}
</style>
<script type="text/javascript">
function pl(name)
{
if (name.checked == true) {name.parentNode.parentNode.className = "checked";} else {name.parentNode.parentNode.className = "xxx";}
}
function plt(name)
{
if (name.checked == true) {name.parentNode.parentNode.parentNode.className = "checked";} else {name.parentNode.parentNode.parentNode.className = "xxx";}
}
</script>
</head>
<body>
<form name="form1" method="post" action="">
<table border="1" cellspacing="0" cellpadding="0" class="">
<tr>
<td width="355">Tableclass 1 - not checked and no class. Works fine.</td>
<td width="120"> </td>
<td width="120"> </td>
<td width="25">
<input type="checkbox" name="checkbox" id="checkbox" onclick="plt(this)"> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
</table>
<br>
<table border="1" cellspacing="0" cellpadding="0" class="checked">
<tr>
<td width="355">Tableclass 2 - checked and class set.</td>
<td width="120"> </td>
<td width="120"> </td>
<td width="25">
<input name="checkbox" type="checkbox" id="checkbox" onclick="plt(this)" checked> </td>
</tr>
<tr>
<td><strong>PROBLEM!</strong> Why does not the background change??</td>
<td> </td>
<td> </td>
<td> </td>
</tr>
</table>
<br>
<table border="1" cellspacing="0" cellpadding="0">
<tr class="">
<td width="355">Rowclass 1 - not checked and no class. Works fine.</td>
<td width="120"> </td>
<td width="120"> </td>
<td width="25">
<input type="checkbox" name="checkbox2" id="checkbox2" onclick="pl(this)"> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
</table>
<br>
<table border="1" cellspacing="0" cellpadding="0">
<tr class="checked">
<td width="355">Row class 2 - checked and class set. Works fine.</td>
<td width="120"> </td>
<td width="120"> </td>
<td width="25">
<input name="checkbox2" type="checkbox" id="checkbox2" onclick="pl(this)" checked> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
</table>
<br>
</form>
</body>
</html>