Page is a not externally linkable
DrDoc - 7:42 am on Aug 20, 2002 (gmt 0)
document.forms[0] is an array as well, comtaining all the elements in the form. What you could do is something like this: <html> Now, say that you have a submit button or anything else after the checkboxes .. Well, simply don't try to check the last object then. function selectAll(){
Thought #2:
<head>
<title>Untitled</title>
<script language="JavaScript" type="text/javascript">
function selectAll(){
t=document.forms[0].length;
for(i=1; i<t; i++) document.forms[0][i].checked=document.forms[0][0].checked;
}
</script>
</head>
<body>
<form method="post" action="script.php">
<input type="checkbox" name="test[]" value="select_all" onclick="selectAll();" />
<input type="checkbox" name="test[a]" value="1" />Choose 1
<input type="checkbox" name="test[b]" value="2" />Choose 2
<input type="checkbox" name="test[c]" value="3" />Choose 3
</form>
</body>
</html>
t=document.forms[0].length;
for(i=1; i<t-1; i++) document.forms[0][i].checked=document.forms[0][0].checked;
}