DOM Objects
DOM Anchor
DOM Applet
DOM Area
DOM Base
DOM Basefont
DOM Body
DOM Button
DOM Checkbox
DOM Document
DOM Event
DOM FileUpload
DOM Form
DOM Frame
DOM Frameset
DOM Hidden
DOM History
DOM Iframe
DOM Image
DOM Link
DOM Location
DOM Meta
DOM Navigator
DOM Option
DOM Password
DOM Radio
DOM Reset
DOM Screen
DOM Select
DOM Style
DOM Submit
DOM Table
DOM TableData
DOM TableHeader
DOM TableRow
DOM Text
DOM Textarea
DOM Window

Textarea Object

For each instance of an HTML <textarea> tag on a form, a Textarea object is created.

All Textarea objects are stored in the elements array of the corresponding form. You can access a Textarea object by indexing this array - either by number (0 represents the first element in a form) or by using the value of the name attribute.

The Textarea object's properties, methods, and events are described below:

N: Netscape (including Mozilla when N6 or higher), IE: Internet Explorer, W3C: World Wide Web Consortium (Internet Standard)

Properties

Syntax: object.property_name

Property Description N IE  W3C
accessKey Sets or returns the keyboard key to access the textarea   4 Yes
cols Sets or returns the width (in characters) of the textarea 6 3.02 Yes
defaultValue Sets or returns the initial contents of the textarea   3.02 Yes
disabled Sets or returns whether or not the textarea should be disabled 6 5.5 Yes
form Returns a reference to the textarea's parent form 2 3.02 Yes
id Sets or returns the id of the textarea (In IE 4 this property is read-only)   4 No
name Sets or returns the name of the textarea 2 3.02 Yes
readOnly Sets or returns whether or not the textarea should be read-only 6 4 Yes
rows Sets or returns the height (in rows) of the textarea 6 3.02 Yes
tabIndex Sets or returns the tab order for the textarea   4 Yes
type Returns the type of the form element. For a textarea object it will always be "textarea" 3 3.02 Yes
value Sets or returns the text in the textarea 2 3.02 Yes

Methods

Syntax: object.method_name()

Method Description N IE W3C
blur() Removes focus from the textarea 2 3.02 Yes
click() Simulates a mouse-click in the textarea   4 No
focus() Sets focus on the textarea 2 3.02 Yes
select() Selects and highlights the entire text that is in the textarea 2 4 Yes

Events

Syntax: object.event_name="someJavaScriptCode"

Event Description N IE W3C
onBlur Executes some code when the textarea loses focus 2 3.02  
onChange Executes some code when the textarea loses focus and its value has altered 2 3.02  
onClick Executes some code when the user clicks the left mouse button in the textarea   4  
onFocus Executes some code when the textarea gets focus 2 3.02  
onKeyDown Executes some code when a key is pressed down in the textarea 4    
onKeyPress Executes some code when a key is pressed in the textarea 4    
onKeyUp Executes some code when a key is released in the textarea 4    
onSelect Executes some code when some text in the textarea is selected 2