JavaScript Object Reference (4)
The password Object
The password object reflects a password text field from an HTML form in JavaScript.
Properties
- defaultValue
- A string value containing the default value of the password element (i.e. the value of the VALUE attribute).
- name
- A string value containing the name of the password element.
- value
- A string value containing the value of the password element.
Methods
- focus()
- Emulates the action of focusing in the password field.
- blur()
- Emulates the action of removing focus from the password field.
- select()
- Emulates the action of selecting the text in the password field.
The radio Object
The radio object reflects a set of radio buttons from an HTML form in JavaScript. To access individual radio buttons, use numeric indexes starting at zero. For instance, individual buttons in a set of radio buttons named testRadio could be referenced by testRadio[0], testRadio[1], etc.
Properties
- checked
- A boolean value indicating if a specific button is checked. Can be used to select or deselect a button.
- defaultChecked
- A boolean value indicating if a specific button was checked by default (i.e. reflects the CHECKED attribute).
- length
- An integer value indicating the number of radio buttons in the set.
- name
- A string value containing the name of the set of radio buttons.
- value
- A string value containing the value a specific radio button in a set (i.e. reflects the VALUE attribute).
Methods
- click()
- Emulates the action of clicking on a radio button.
Event Handlers
- onClick
- Specifies JavaScript code to execute when a radio button is clicked.
The reset Object
The reset object reflects a reset button from an HTML form in JavaScript.
Properties
- name
- A string value containing the name of the reset element.
- value
- A string value containing the value of the reset element.
Methods
- click()
- Emulates the action of clicking on the reset button.
Event Handlers
- onClick
- Specifies JavaScript code to execute when the reset button is clicked.
The select Object
The select object reflects a selection list from an HTML form in JavaScript.
Properties
- length
- An integer value containing the number of options in the selection list.
- name
- A string value containing the name of the selection list.
- options
- An array reflecting each of the options in the selection list in the order they appear. The options property has it's own properties:
defaultSelected
A boolean value indicating if an option was selected by
default (i.e. reflects the SELECTED attribute).
index
An integer value reflecting the index of an option.
length
An integer value reflecting the number of options in the
selection list.
name
A string value containing the name of the selection list.
options
A string value containing the full HTML code for the
selection list.
selected
A boolean value indicating if the option is selected. Can
be used to select or deselect an option.
selectedIndex
An integer value containing the index of the currently
selected option.
text
A string value containing the text displayed in the
selection list for a particular option.
value
A string value indicating the value for the specified
option (i.e. reflects the VALUE attribute).
- selectedIndex
- Reflects the index of the currently selected option in the selection list.
Event Handlers
- onBlur
- Specifies JavaScript code to execute when the selection list loses focus.
- onFocus
- Specifies JavaScript code to execute when focus is given to the selection list.
- onChange
- Specifies JavaScript code to execute when the selected option in the list changes.
Previous | Contents | Next
|