Moderator |
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title></title>
<script type="text/javascript">
<!--
function checkall(form, element, check, start, end)
{
// flip check? kijk of eerste element checked is en draai deze om
check = !(document.getElementById(form+'['+element+']['+start+']').checked == check);
for (var i=start; i <= end; i++)
{
document.getElementById(form+'['+element+']['+i+']').checked = check;
}
}
//-->
</script>
</head>
<body>
<form name="formName" id="formName" action="" method="post">
<input type="checkbox" name="formName[test][1]" id="formName[test][1]" value="1" />1<br />
<input type="checkbox" name="formName[test][2]" id="formName[test][2]" value="2" />2<br />
<input type="checkbox" name="formName[test][3]" id="formName[test][3]" value="4" />4<br />
<button type="button" onclick="checkall('formName', 'test', true, 1, 3)">check / clear all</button>
</form>
<form name="formName2" id="formName2" action="" method="post">
<input type="checkbox" name="formName2[test][1]" id="formName2[test][1]" value="1" />1<br />
<input type="checkbox" name="formName2[test][2]" id="formName2[test][2]" value="2" />2<br />
<input type="checkbox" name="formName2[test][3]" id="formName2[test][3]" value="4" />4<br />
<input type="checkbox" name="formName2[test][4]" id="formName2[test][4]" value="8" />8<br />
<input type="checkbox" name="formName2[test][5]" id="formName2[test][5]" value="16" />16<br />
<button type="button" onclick="checkall('formName2', 'test', true, 1, 5)">check / clear all</button>
</form>
</body>
</html>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title></title> <script type="text/javascript"> <!-- function checkall (form , element , check , start , end) { // flip check? kijk of eerste element checked is en draai deze om check = !(document.getElementById(form+'['+element+']['+start+']').checked == check); for (var i =start ; i <= end; i ++) { document.getElementById(form+'['+element+']['+i+']').checked = check; } } //--> </script> </head> <body> <form name="formName" id="formName" action="" method="post"> <input type="checkbox" name="formName[test][1]" id="formName[test][1]" value="1" />1<br /> <input type="checkbox" name="formName[test][2]" id="formName[test][2]" value="2" />2<br /> <input type="checkbox" name="formName[test][3]" id="formName[test][3]" value="4" />4<br /> <button type="button" onclick="checkall('formName', 'test', true, 1, 3)">check / clear all</button> </form> <form name="formName2" id="formName2" action="" method="post"> <input type="checkbox" name="formName2[test][1]" id="formName2[test][1]" value="1" />1<br /> <input type="checkbox" name="formName2[test][2]" id="formName2[test][2]" value="2" />2<br /> <input type="checkbox" name="formName2[test][3]" id="formName2[test][3]" value="4" />4<br /> <input type="checkbox" name="formName2[test][4]" id="formName2[test][4]" value="8" />8<br /> <input type="checkbox" name="formName2[test][5]" id="formName2[test][5]" value="16" />16<br /> <button type="button" onclick="checkall('formName2', 'test', true, 1, 5)">check / clear all</button> </form> </body> </html>
|