Password object is created by using an HTML <INPUT> tag and
assigning "password" to the TYPE attribute. When a user then enters a
password, an asterisk (*) is displayed for every character entered, thus
hiding the value of the password from the view of others. A Password
runtime engine will then create an entry for it in the elements
property of the appropriate Form object. The Password object
can then be accessed through this elements array by referencing
either its element number or name, if a NAME attribute was used in its
creation. For example, the following HTML code creates a password field
with the name "Pass" and no initial value:
<input type = "password" name = "pass" value = ""
size = 20>
in the password field as in the following example which, if the user's
entry matches the value previously stored in the MyPassWord variable,
executes a function called AllowEntry.
if(document.myForm.pass.value == myPassWord)
If a user alters a password interactively, it can only be evaluated
accurately if data-tainting is enabled.
This property, tainted by default, is a string reflecting the VALUE
attribute of a Password object. Initially this is null
(for security reasons) regardless of any value assigned to it. You can
override the initial defaultValue property at any time by setting
it programmatically, although this won't be reflected in the display
of the Password object.
This property is a reference to the parent form to which a particular
Password object belongs.
This property, which is tainted by default, is a string reflecting the
NAME attribute of a Password object, and can be set at any time,
overriding the previous value.
If more than one object on any form share the same NAME attribute,
an array of those objects is automatically created.
This property reflects the type of any particular object on a form,
and in the case of the Password object is always "password".
This property, tainted by default, reflects the value entered into a
password field by the user. It can be set programatically at any time,
but if a user tries to alter it interactively, it won't be evaluated
properly unless data-tainting is enabled. Whether altered or not, the
value is at all times displayed as a string of asterisks.
This method is used to remove focus from the object.
This method is used to give focus to an object. It can be used to focus
on a Password object prior to a value being entered, either by
This method calls the handler for a specified event.
This method causes the input area of a Password object to be
selected and the cursor to be positioned ready for user input.
The Select object also inherits the watch
and unwatch methods from the
blur event occurs; i.e. whenever a window, frame or form element loses
i.e. whenever the user focuses on a window, frame or frameset, or inputs
to a form element.