Tutorials
JavaScriptCheckbox is a field that allows multiple selections for the user from a group. The checkbox object of JavaScript is used to access a checkbox that is present in a form. The checkbox object is a property of the form object.
<INPUT TYPE="checkbox" NAME="some name" VALUE="some value" CHECKED onClick="Functionname">
For example:
<INPUT TYPE="checkbox" NAME="Exforsys" VALUE="2" CHECKED onClick="Testfunc">
In the above example, the attributes CHECKED and onClick are optional and the TYPE, NAME and VALUE are mandatory. The above statement creates a checkbox that belongs to a group. If it is selected or checked, the value given in the parameter (in this example 2) is returned followed by invocation of the function Testfunc.
The following are the properties associated with checkbox object:
checked property of checkbox object indicates that the value is true when the button is checked.
defaultChecked property of checkbox object has the value true if the checkbox object by default is in checked state.
form property of checkbox object indicates the form object, including the checkbox button.
name property of checkbox object denotes the name of the checkbox button
type property of checkbox object denotes the type of element as checkbox.
value property of checkbox object denotes the value of the button.
The blur() method of JavaScript belongs to the checkbox object and takes the focus away from the checkbox.
The click() method of JavaScript belongs to the checkbox object and is used to indicate the checkbox as clicked as if the user has clicked it.
The click() method of JavaScript belongs to the checkbox object and is used to give the focus to the checkbox.
First Page: JavaScript Browser Objects Part 2