<Input type = checkbox name = mm value = a onclick = "checkitem (this, 'mmall')"> <br>
<Input type = checkbox name = mm value = B onclick = "checkitem (this, 'mmall')"> <br>
<Input type = checkbox name = mm value = C onclick = "checkitem (this, 'mmall')"> <br>
<Input type = checkbox name = mm value = D onclick = "checkitem (this, 'mmall')"> <br>
<Input type = checkbox name = mm value = e onclick = "checkitem (this, 'mmall')"> <br>
<Input type = checkbox name = mmall onclick = "checkall (this, 'mm')"> select all or not
<Script language = JavaScript>
Function checkall (E, itemname)
{
VaR AA = Document. getelementsbyname (itemname );
For (VAR I = 0; I <AA. length; I ++)
AA [I]. Checked = E. checked;
}
Function checkitem (E, allname)
{
VaR all = Document. getelementsbyname (allname) [0];
If (! E. Checked) All. Checked = false;
Else
{
VaR AA = Document. getelementsbyname (E. Name );
For (VAR I = 0; I <AA. length; I ++)
If (! AA [I]. Checked) return;
All. Checked = true;
}
}
</SCRIPT>
PS: (of course, if the all-selected box is another control, such as a button or a link, the checkitem click event in the check box can be removed to avoid errors)