Technical Training
JavaScript TutorialJavaScript Checkbox Object
JavaScript Browser Objects Part 2
checkbox object:
Checkbox 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.
Ads
General syntax of checkbox object in JavaScript is as follows:
<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
- form
- name
- type
- value
checked:
checked property of checkbox object indicates that the value is true when the button is checked.
defaultChecked:
defaultChecked property of checkbox object has the value true if the checkbox object by default is in checked state.
form:
form property of checkbox object indicates the form object, including the checkbox button.
name:
name property of checkbox object denotes the name of the checkbox button
type:
type property of checkbox object denotes the type of element as checkbox.
value:
value property of checkbox object denotes the value of the button.
Methods of checkbox object:
- blur()
- click()
- focus()
Ads
blur():
The blur() method of JavaScript belongs to the checkbox object and takes the focus away from the checkbox.
click():
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.
focus():
The click() method of JavaScript belongs to the checkbox object and is used to give the focus to the checkbox.
JavaScript Tutorial
- JavaScript Browser Objects Part 2
- JavaScript Frame object
- JavaScript Form Object
- JavaScript FileUpload Object
- JavaScript Event Object Properties and Methods
- JavaScript Event Object
- JavaScript Elements and Embed Objects
- JavaScript Applet Objects
- JavaScript Browser Objects
- JavaScript Object Oriented Features
- JavaScript Window Object Open Method Part 2
- JavaScript Window Object Open Method
- JavaScript Window Object Timeout Methods
- JavaScript Location Object
- JavaScript Location Object Properties
- JavaScript History Object Properties and Methods
- JavaScript Document Object Methods Part II
- JavaScript Document Object Methods Part I
- JavaScript Document Object Properties
- JavaScript Document Object
- JavaScript Windows Object Properties Part II
- JavaScript Windows Object Properties Part I
- JavaScript DOM Window Object
- Working with JavaScript DOM Objects
- JavaScript Array Object Methods – Part II
- JavaScript Array Object
- JavaScript Array Object Methods – Part I
- JavaScript Boolean Object
- JavaScript OnError Event
- JavaScript Exception Handling – Part II
- JavaScript Exception Handling – Part I
- JavaScript Event Handler
- JavaScript Events Handling
- JavaScript Array Operations
- JavaScript Two Dimensional Arrays
- Passing values to JavaScript Function
- JavaScript Functions
- JavaScript Arrays
- JavaScript Iterative Structures - Part II
- JavaScript Iterative Structures - Part I
- JavaScript Math Object
- JavaScript Date Object
- JavaScript String Object
- JavaScript Objects
- JavaScript Confirm Box
- JavaScript Alert Box
- JavaScript Conditional Statements Part 2
- JavaScript Conditional Statements Part 1
- How to use JavaScript in HTML page
- JavaScript Variables
- JavaScript Features
- JavaScript Introduction







