JavaScript Password Object

The JavaScript Password object is a property of the form object. Password FORM syntax is:

<INPUT
     TYPE="password"
     NAME="passwordName"
     [VALUE="contents"]
     [SIZE="integer"]
     [MAXLENGTH="integer"]
     [onBlur="handlerStatement"]
     [onChange="handlerStatement"]
     [onFocus="handlerStatement"]
     [onSelect="handlerStatement"]>

An password example:

<INPUT TYPE="password" NAME="thisPwd" SIZE=10 MAXLENGTH=15 VALUE="">

How it looks:


The password element may be accessed using one of the following methods:

[window.]document.forms[index].elements[index]
[window.]document.forms[index].passwordName
[window.]document.formName.elements[index]
[window.]document.formName.passwordName

Properties

  • defaultValue - The default value of the password object.
  • form- The form object that includes the password object.
  • name - The name of the password object.
  • type - The type of element which is password.
  • value - The value of the password object.



Methods

  • blur() - Takes the focus away from the password object.
  • focus() - Gives the focus to the password object.
  • select() - The contents of the password object are selected.

Events

  • onBlur
  • onFocus