Here's the code:
<script language="javascript">
function checkAll(list, tick)
{
for (i = 0; i < list.length; i++)
list[i].checked = tick.checked? true:false
}
</script>
<form id="mylist" name="list">
<input type="checkbox" name="toggle" onclick="
javascript:checkAll(document.list.check, this)" />All
<input type="checkbox" name="check" value="one" />One
<input type="checkbox" name="check" value="two" />Two
<input type="checkbox" name="check" value="three" />Three
<input type="checkbox" name="check" value="four" />Four
<input type="checkbox" name="check" value="five" />Five
</form>
Result:
No comments:
Post a Comment