You ready?
<script type="text/javascript">
function checkall(id,value) {
var form = document.getElementById(id);
for (var n=0; n< form.length; n++)
if (form.elements[n].type == 'checkbox')
form.elements[n].checked = value;
return false;
}
</script>
<form id="myForm">
<ul>
<li><input type="checkbox" onclick="checkall('myForm', this.checked)">Check all</li>
<li><input type="checkbox">Check me!</li>
<li><input type="checkbox">Check me, too!</li>
<li><input type="checkbox">Check this third box.</li>
</ul>
</form>
Code markup via quickhighlighter.com
function checkall(id,value) {
var form = document.getElementById(id);
for (var n=0; n< form.length; n++)
if (form.elements[n].type == 'checkbox')
form.elements[n].checked = value;
return false;
}
</script>
<form id="myForm">
<ul>
<li><input type="checkbox" onclick="checkall('myForm', this.checked)">Check all</li>
<li><input type="checkbox">Check me!</li>
<li><input type="checkbox">Check me, too!</li>
<li><input type="checkbox">Check this third box.</li>
</ul>
</form>