DOM Objects
DOM Anchor
DOM Applet
DOM Area
DOM Base
DOM Basefont
DOM Body
DOM Button
DOM Checkbox
DOM Document
DOM Event
DOM FileUpload
DOM Form
DOM Frame
DOM Frameset
DOM Hidden
DOM History
DOM Iframe
DOM Image
DOM Link
DOM Location
DOM Meta
DOM Navigator
DOM Option
DOM Password
DOM Radio
DOM Reset
DOM Screen
DOM Select
DOM Style
DOM Submit
DOM Table
DOM TableData
DOM TableHeader
DOM TableRow
DOM Text
DOM Textarea
DOM Window

Password Object

For each instance of an HTML <input type="password"> tag on a form, a Password object is created.

All Password objects are stored in the elements array of the corresponding form. You can access a Password object by indexing this array - either by number (0 represents the first element in a form) or by using the value of the name attribute.

The Password object's properties, methods, and events are described below:

N: Netscape (including Mozilla when N6 or higher), IE: Internet Explorer, W3C: World Wide Web Consortium (Internet Standard)

Properties

Syntax: object.property_name

Property Description N IE  W3C
accept Sets or returns a list of content types that the server that processes this form will handle correct   - Yes
accesskey Sets or returns the keyboard key to access the password field   4 Yes
defaultValue Sets or returns the initial value of the password field 2 3.02 Yes
disabled Sets or returns whether or not the password field should be disabled 6 5.5 Yes
form Returns a reference to the password field's parent form 2 3.02 Yes
id Sets or returns the id of the password field (In IE 4 this property is read-only)   4 No
maxLength Sets or returns the maximum number of characters the user can enter in the password field 6 4 Yes
name Sets or returns the name of the password field 2 3.02 Yes
readOnly Sets or returns whether the content of the password field is read-only 6 4 Yes
size Sets or returns the size of the password field 6 3.02 Yes
tabIndex Sets or returns the index that defines the tab order for the password field   4 Yes
type The type of the form element. For a password object it will always be "password" 3 3.02 Yes
value Sets or returns the value of the value attribute of the password field 2 3.02 Yes

Methods

Syntax: object.method_name()

Method Description N IE W3C
blur() Removes focus from the password field 2 4 Yes
click() Simulates a mouse-click on the password field   4 No
focus() Sets focus on the password field 2 3.02 Yes
select() Selects and highlights the entire text that is in the password field 2 4 Yes

Events

Syntax: object.event_name="someJavaScriptCode"

Event Description N IE W3C
onBlur Executes some code when the password field loses focus 2 4  
onClick Executes some code when the user clicks in the password field   4  
onFocus Executes some code when the password field gets focus 2 3.02  
onKeyDown Executes some code when a key is pressed down in the password field 4 4  
onKeyPress Executes some code when an alphanumeric key is pressed in the password field 4 4  
onKeyUp Executes some code when a key is released in the password field 4 4  
onSelectStart Executes some code when some text in the password field is selected   4