<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>www.tutorials.de</title>
<meta name="author" content="Quaese">
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
<script type="text/javascript">
<!--
function abschalt(objElem,typus,start,ende){
var arrSplit = objElem.value.split("_");
var blnCheck = (objElem.checked)? true : false;
var j = 0;
var i = 1;
var objCheckbox = null;
// Zeilen
if(arrSplit[0] == "row"){
for (i=0;i<=ende;i++){
// Erste Checkbox ermitteln
while (!objCheckbox && i<=ende){
i++;
objCheckbox = document.getElementsByName("svmod["+arrSplit[1]+"]["+i+"]")[0];
}
// Solange Checkboxen existieren
// Checkbox wählen/abwählen
objCheckbox.checked = blnCheck;
// wenn Checkbox fehlt
while (!objCheckbox && i<=ende){
i++;
objCheckbox = document.getElementsByName("svmod["+arrSplit[1]+"]["+i+"]")[0];
}
j=i+1;
// Nächste Checkbox ermitteln
objCheckbox = document.getElementsByName("svmod["+arrSplit[1]+"]["+j+"]")[0];
}
// Spalten
}else if(arrSplit[0] == "col"){
for (i=0;i<=ende;i++){
while (!objCheckbox && i<=ende){
i++;
objCheckbox = document.getElementsByName("svmod["+i+"]["+arrSplit[1]+"]")[0];
}
objCheckbox.checked = blnCheck;
while (!objCheckbox && i<=ende){
i++;
objCheckbox = document.getElementsByName("svmod["+i+"]["+arrSplit[1]+"]")[0];
}
j=i+1;
objCheckbox = document.getElementsByName("svmod["+j+"]["+arrSplit[1]+"]")[0];
}
}
}
//-->
</script>
</head>
<body>
<table >
<tr>
<td> </td>
<td><input type="checkbox" name="svmod[0][1]" value="col_1" onclick="abschalt(this,2,3)"></td>
<td><input type="checkbox" name="svmod[0][2]" value="col_2" onclick="abschalt(this,1,3)"></td>
<td><input type="checkbox" name="svmod[0][3]" value="col_3" onclick="abschalt(this,1,3)"></td>
</tr>
<tr>
<td><input type="checkbox" name="svmod[1][0]" value="row_1" onclick="abschalt(this,2,3)"></td>
<td></td>
<td><input type="checkbox" name="svmod[1][2]" value="2"></td>
<td><input type="checkbox" name="svmod[1][3]" value="2"></td>
</tr>
<tr>
<td><input type="checkbox" name="svmod[2][0]" value="row_2" onclick="abschalt(this,1,3)"></td>
<td><input type="checkbox" name="svmod[2][1]" value="2"></td>
<td></td>
<td><input type="checkbox" name="svmod[2][3]" value="2"></td>
</tr>
<tr>
<td><input type="checkbox" name="svmod[3][0]" value="row_3" onclick="abschalt(this,1,3)"></td>
<td><input type="checkbox" name="svmod[3][1]" value="2"></td>
<td><input type="checkbox" name="svmod[3][2]" value="2"></td>
<td><input type="checkbox" name="svmod[3][3]" value="2"></td>
</tr>
</table>
</body>
</html>