HTML DOM Password object
The Password object
The Password object represents the password field in the HTML form.
For every time a label appears on a form, a Password object is created.
This text input field allows the user to enter certain sensitive data, such as passwords. W hen the user enters, his input is masked (e.g. using an asterisk) to prevent the person next to him from seeing the input from behind him. Note, however, that when a form is submitted, the input is sent in clear text.
Similar to an element of type "text," it triggers the onchange event handle when the user changes the display value.
You can access the password field by traversing the form's elements.array, or by using document.getElementById().
Password object properties
W3C: W3C standard.
Attributes | describe | W3C |
---|---|---|
defaultValue | Set or return the default value of the password field. | Yes |
disabled | Set or returns whether the password field should be disabled. | Yes |
form | Returns a reference to a form that contains this password field. | Yes |
maxLength | Set or return the maximum number of characters in the password field. | Yes |
name | Set or return to the name of the password field. | Yes |
readOnly | Set or return to the password field should be read-only. | Yes |
size | Set or return the length of the password field. | Yes |
type | Returns the type element type of the password field. | Yes |
value | Set or return the value of the value attribute of the password field. | Yes |
The Password object method
method | describe | W3C |
---|---|---|
select() | Select the text in the password field. | Yes |
Standard properties and events
The Password object also supports the standard properties and events.