Name
Checkbox — a graphical checkbox
Availability
JavaScript 1.0; enhanced in JavaScript 1.1
Inherits from/Overrides
Inherits from Input, HTMLElement
Synopsis
A single Checkbox element with a unique name may be referenced in either of these ways:
form.checkbox_nameform.elements[i]
When a form contains a group of checkboxes with the same name, they are placed in an array and may be referenced as follows:
form.checkbox_name[j] form.checkbox_name.length Properties
Checkbox inherits properties from Input and HTMLElement and defines or overrides the following:
-
checked A read/write boolean property. If the checkbox is checked, the
checkedproperty istrue. If the checkbox is not checked,checkedisfalse.
If you set checked to true, the
checkbox appears checked. Similarly, if you set this property to
false, the checkbox appears unchecked. Note that
setting the checked property does not cause the
Checkbox element’s onclick event handler to
be invoked.
-
defaultChecked A read-only boolean that specifies the initial state of the checkbox. It is
trueif the checkbox is initially checked -- i.e., if thecheckedattribute appears in the checkbox’s HTML<input>tag. If this attribute does not appear, the checkbox is initially unchecked anddefaultCheckedisfalse.-
value A read/write string property that specifies the text passed to the web server if the checkbox is checked when the form is submitted. The initial value of
valueis specified by thevalueattribute of the checkbox’s HTML<input> ...