Both radio and checkbox have no onchange events, which can be replaced by onclick and custom functions.
However, the checkbox has an onpropertychange event, so you can use onpropertychange to trigger the is selection.
Basic operations of the checkbox:
1. Select an operation ---> onpropertychange, the built-in event processing function of checkbox
2. Select All ---> selectall ();
Detailed description:
1. Select an operation
<Input type = "checkbox" value = "checkbox1" onpropertychange = "javascript: Alert ('checkbox1 was click! '); "> Checkbox1 </>
2. Select All
Function selectall ()
{
VaR isselect = false;
If (document. All. CHX. value = "select all ")
{
Isselect = true;
Document. All. CHX. value = "reselect"
}
Else
{
Isselect = false;
Document. All. CHX. value = "select all"
}
// Var checkboxs = Document. getelementsbyname ("");
VaR checkboxs = Document. form1.elements;
For (VAR I = 0; I <checkboxs. length; I ++)
{
If (checkboxs [I]. type = "checkbox ")
{
Checkboxs [I]. Checked = isselect;
}
}
}