please dont rip this site

JavaScript: The Definitive Guide

Previous Chapter 21
JavaScript Reference
Next
 

Password Element

Name

Password Element---input field for sensitive data

Availability

Navigator 2.0, Internet Explorer 3.0; enhanced in Navigator 3.0

Synopsis

form.name
form.elements[i]

Properties

defaultValue

A read-only string that specifies the initial value to appear in the password input field. This property is specified by the VALUE attribute of the HTML tag that created the Password element.

form

A read-only reference to the Form object that contains the Password element.

name

A read-only string, set by the HTML NAME attribute, that specifies the name of the Password element. This is also the name that can be used to reference the Password element as a property of its form.

type

A read-only string that specifies the type of this form element. For Password elements, it has the value "password". Available in Navigator 3.0 and later.

value

In Navigator 3.0, with the data-tainting security model enabled, this property is a read-only string that specifies the password value entered by the user. In Navigator 2.0, and in 3.0 without data tainting enabled, this property exists, but always contains the empty string.

Methods

blur()

Remove the keyboard focus from the Password element.

focus()

Set the keyboard focus to the Password element. When focus is set, all keystrokes are automatically entered into this element.

select()

Highlight all the text in the Password element, and enter a special mode so that future input replaces the highlighted text.

Event Handlers

onblur()

Invoked when a user action causes the Password element to lose the keyboard focus.

onchange()

Invoked when the user changes the value in the Password element and moves the keyboard focus elsewhere. This event handler is not invoked for every keystroke in the Password element, but only when the user completes an edit.

onfocus()

Invoked when a user action causes the Password element to gain the keyboard focus.

HTML Syntax

A Password element is created with a standard HTML <INPUT> tag:

<FORM>
    ...
  <INPUT
    TYPE="password" specifies that this is a Password element
    [ NAME="name" ]   a name that can later be used to refer to this element
    specifies the name property
    [ VALUE="default" ]   the default value transmitted when the form is submitted
    [ SIZE=integer ]  how many characters wide the element is
  >
    ...
</FORM>

Description

The Password element is a text input field intended for input of sensitive data, such as passwords. As the user types characters, only asterisks appear, so that the input value cannot be read by a bystander looking over the user's shoulder.

As an additional security precaution, JavaScript cannot read the value typed by the user either. The value property is a read-only string that initially contains the value specified by the VALUE attribute. The user's input is transmitted to the server when the form is submitted, but that input does not appear in this property. Setting this property has no effect on the value transmitted. The VALUE attribute specifies the data to be transmitted if the user does not type anything, and this default value is the only thing to which JavaScript has access.

See Also

"Element", "Form", "Text"


Previous Home Next
parseInt() Book Index Password.blur()

HTML: The Definitive Guide CGI Programming JavaScript: The Definitive Guide Programming Perl WebMaster in a Nutshell

file: /Techref/language/JAVA/SCRIPT/definitive/refp_296.htm, 8KB, , updated: 2019/10/14 15:00, local time: 2024/12/19 04:52,
TOP NEW HELP FIND: 
18.118.142.126:LOG IN

 ©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions?
Please DO link to this page! Digg it! / MAKE!

<A HREF="http://massmind.org/techref/language/JAVA/SCRIPT/definitive/refp_296.htm"> [Chapter 21] Reference: Password</A>

After you find an appropriate page, you are invited to your to this massmind site! (posts will be visible only to you before review) Just type a nice message (short messages are blocked as spam) in the box and press the Post button. (HTML welcomed, but not the <A tag: Instead, use the link box to link to another page. A tutorial is available Members can login to post directly, become page editors, and be credited for their posts.


Link? Put it here: 
if you want a response, please enter your email address: 
Attn spammers: All posts are reviewed before being made visible to anyone other than the poster.
Did you find what you needed?

 

Welcome to massmind.org!

 

Welcome to massmind.org!

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

  .