<html>
<head>
<title></title>
<script type="text/javascript">
function checkAll(obj, id)
{
var ml = document.dataform;
var len = ml.elements.length;
for (var i = 0; i < len; i ++ )
{
var box = ml.elements[i];
if (box.name == "checkboxes[]")
{
if (box.checked == false) box.checked = true;
if (box.checked == false) box.parentNode.parentNode.style.backgroundColor = (box.checked) ? '#FFFEFE' : '#FFCC99';
if (box.checked == false) box.parentNode.parentNode.nextSibling.nextSibling.style.backgroundColor = (box.checked) ? '#FFFEFE' : '#FFCC99';
if (box.checked == true) box.parentNode.parentNode.style.backgroundColor = (box.checked) ? '#FFCC99' : '#FFFEFE';
if (box.checked == true) box.parentNode.parentNode.nextSibling.nextSibling.style.backgroundColor = (box.checked) ? '#FFCC99' : '#FFFEFE';
}
}
}
function uncheckAll()
{
var ml = document.dataform;
var len = ml.elements.length;
for (var i = 0; i < len; i ++ )
{
var box = ml.elements[i];
if (box.name == "checkboxes[]")
{
if (box.checked == true) box.checked = false;
if (box.checked == false) box.parentNode.parentNode.style.backgroundColor = (box.checked) ? '#FFCC99' : '#FFFEFE';
if (box.checked == true) box.parentNode.parentNode.style.backgroundColor = (box.checked) ? '#FFFEFE' : '#FFCC99';
if (box.checked == false) box.parentNode.parentNode.nextSibling.nextSibling.style.backgroundColor = (box.checked) ? '#FFCC99' : '#FFFEFE';
if (box.checked == true) box.parentNode.parentNode.nextSibling.nextSibling.style.backgroundColor = (box.checked) ? '#FFFEFE' : '#FFCC99';
}
}
}
function switchAll()
{
var ml = document.dataform;
var len = ml.elements.length;
for (var i = 0; i < len; i ++ )
{
var box = ml.elements[i];
if (box.name == "checkboxes[]")
{
box.checked = ! box.checked;
if (box.checked == false) box.parentNode.parentNode.style.backgroundColor = '#FFFEFE';
if (box.checked == true) box.parentNode.parentNode.style.backgroundColor = '#FFCC99';
if (box.checked == false) box.parentNode.parentNode.nextSibling.nextSibling.style.backgroundColor = '#FFFEFE';
if (box.checked == true) box.parentNode.parentNode.nextSibling.nextSibling.style.backgroundColor = '#FFCC99';
}
}
}
function colors(tr, inout)
{
var elem = document.getElementById('cb_' + tr.id);
if( ! elem.checked)
{
var col;
col = tr.style.backgroundColor;
if(inout == true)
{
col = '#CCFFCC';
}
else
{
col = '#FFFEFE';
}
}
tr.style.backgroundColor = col;
tr.nextSibling.nextSibling.style.backgroundColor = col;
}
</script>
</head>
<body>
<form name="dataform" id="dataform" method="post" action="index.php">
<table border="1">
<?php
for($i = 0; $i < 10; $i++){
?>
<tr style="background-color: #FFFEFE;" id="<?php echo $i; ?>" onMouseOver="colors(this,true);" onMouseOut="colors(this,false);">
<td align="center" valign="top" width="20px"><input class="checkbox" type="checkbox" name="checkboxes[]" id="cb_<?php echo $i;?>" value="<?php echo $i;?>" onfocus="this.blur();" onclick="parentNode.parentNode.style.backgroundColor = (checked) ? '#FFCC99' : '#FFFEFE';parentNode.parentNode.nextSibling.nextSibling.style.backgroundColor = (checked) ? '#FFCC99' : '#FFFEFE';"></td>
<td align="center" valign="top" width="150px"><span class="text">Name</span></td>
<td align="center" valign="top" width="150px"><span class="text">Vorname</span></td>
<td align="center" valign="top" width="150px"><span class="text">Strasse</span></td>
<tr>
<tr>
<td colspan="4">Bemerkung</td>
</tr>
<?php
}
?>
</table>
</form>
<input type="button" value="Alle" onClick="checkAll();">
<input type="button" value="Keine" onClick="uncheckAll();">
<input type="button" value="Spiegeln" onClick="switchAll();">
</body>
</html>