Section 25.280. Textarea: a multiline text input area


25.280. Textarea: a multiline text input area

DOM Level 2 HTML: Node Element HTMLElement Textarea

25.280.1. Properties


String defaultValue

The initial content of the text area. When the form is reset, the text area is restored to this value. Setting this property changes the displayed text in the text area.


readonly Form form

The Form object that represents the <form> element containing this Textarea, or null if this element is not inside a form.


readonly String type

The type of this element, for compatibility with Input objects. This property always has the value "textarea".


String value

The text currently displayed in the text area. The initial value of this property is the same as the defaultValue property. When the user types into this element, the value property is updated to match the user's input. If you set the value property explicitly, the string you specify is displayed in the Textarea object. This value property contains the text that is sent to the server when the form is submitted.

In addition to these properties, Textarea objects also mirror HTML attributes with the following properties:

Property

Attribute

Description

String accessKey

accesskey

Keyboard shortcut character

long cols

cols

The width in character columns

boolean disabled

disabled

Whether the Textarea is disabled

String name

name

Textarea name for form submission and element access.

boolean readOnly

readonly

Whether the Textarea is noneditable

long rows

rows

Height of Textarea in lines

long tabIndex

tabindex

Position of Textarea in tabbing order


25.280.2. Methods


blur( )

Takes keyboard focus away from this element.


focus( )

Transfers keyboard focus to this element.


select( )

Selects the entire contents of the text area.

25.280.3. Event Handlers


onchange

Invoked when the user edits the text displayed in this element and then moves the keyboard focus elsewhere. This event handler is not invoked for every keystroke in the Textarea element but only when the user completes an edit.

25.280.4. HTML Syntax

A Textarea is created with standard HTML <textarea> and </textarea> tags:

 <form>     ...   <textarea     [ name="name" ]        // A name that can be used to refer to this element     [ rows="integer" ]     // How many lines tall the element is     [ cols="integer" ]     // How many characters wide the element is     [ onchange="handler" ] // The onchange( ) event handler   >   plain_text             // The initial text; specifies defaultValue </textarea> ...</form> 

25.280.5. Description

A Textarea object represents an HTML <textarea> element that creates a multiline text input field (usually within an HTML form). The initial contents of the text area are specified between the <textarea> and </textarea> tags. You can query and set the text with the value property.

Textarea is a form input element like Input and Select. Like those objects, it defines form, name, and type properties.

25.280.6. See Also

Form, Input; Chapter 18




JavaScript. The Definitive Guide
JavaScript: The Definitive Guide
ISBN: 0596101996
EAN: 2147483647
Year: 2004
Pages: 767

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net