TEXTAREA object (Object/DOM)

A multiple line text cell in a form.

Availability:

DOM level - 1
JavaScript - 1.0
JScript - 1.0
Internet Explorer - 3.02
Netscape - 2.0
Opera - 3.0
Inherits from:Input object
JavaScript syntax:IEmyTEXTAREA = myDocument.all.anElementID
IEmyTEXTAREA = myDocument.all.tags("TEXTAREA")[anIndex]
IEmyTEXTAREA = myDocument.all[aName]
-myTEXTAREA = myDocument.getElementById(anElementID)
-myTEXTAREA = myDocument.getElementsByName(aName)[anIndex]
-myTEXTAREA = myDocument.getElementsByTagName("TEXTAREA")[anIndex]
HTML syntax:<TEXTAREA> ... </TEXTAREA>
Argument list:anIndexA reference to an element in a collection
aNameAn associative array reference
anElementIDThe ID value of an Element object
Object properties:cols, readOnly, rows, type, value, wrap
Object methods:handleEvent(), select()
Event handlers:onAfterUpdate, onBeforeUnload, onBeforeUpdate, onBlur, onChange, onDragStart, onErrorUpdate, onFilterChange, onFocus, onHelp, onKeyDown, onKeyPress, onKeyUp, onMouseDown, onMouseMove, onMouseOut, onMouseOver, onMouseUp, onRowEnter, onRowEnter?, onRowExit, onScroll, onSelect, onSelectStart

Many properties, methods and event handlers are inherited from the Input object class. Refer to topics grouped with the "Input" prefix for details of common functionality across all sub-classes of the Input object super-class.

Untypically, there actually is a TEXTAREA class supported by MSIE. Most other kinds of input are simply an instance of the Input object class. Netscape prior to version 6.0 internally represents this object as a sub-class of the Input object even though it is created by a different HTML tag.

Event handling support via properties containing function objects was added to TEXTAREA objects at version 1.1 of JavaScript, but this will have changed to reflect the new DOM event model for Netscape 6.0.

Unlike MSIE, the Netscape 4 implementation of this sub-class of the Input object does not support the click() method or the onSelect event.

The example below seems to be supported by all browsers apart from Netscape 6.0. On this browser, the escape sequence \x0D needs to be changed to \n in order for the example to work.

Example code:

   <HTML>
   <HEAD>
   </HEAD>
   <BODY>
   <FORM>
   Type some lines of text into the text area, click the button and they will be sorted.<BR><BR>
   <TEXTAREA VALUE="" NAME="BOX_A" ROWS=15 COLS=39></TEXTAREA><BR>
   <INPUT TYPE="button" VALUE="Reveal" onClick="handleClick()">
   </FORM>
   <SCRIPT>
   function handleClick()
   {
      myString = document.forms[0].BOX_A.value;
   	myArray = myString.split("\x0D");
      myArray.sort();
      document.forms[0].BOX_A.value = myArray.join("\x0D");
   }
   </SCRIPT>
   </BODY>
   </HTML>

See also:Element object, Element.isTextEdit, Form.elements[], Input object, Input.accessKey, onChange, onKeyDown, onKeyPress, onKeyUp, TEXTAREA.handleEvent(), TextRange object

PropertyJavaScriptJScriptNIEOperaNESECMADOMCSSHTMLNotes
cols1.5 1.53.0 3.06.0 6.04.0 4.0 n/a n/a n/a1 1 n/a n/a-
readOnly1.5 1.53.0 3.06.0 6.04.0 4.0 n/a n/a n/a1 1 n/a n/aReadOnly.
rows1.5 1.53.0 3.06.0 6.04.0 4.0 n/a n/a n/a1 1 n/a n/a-
type1.1 1.13.0 3.03.0 3.04.0 4.03.0 3.0 n/a n/a1 1 n/a n/aReadOnly.
value1.0 1.01.0 1.02.0 2.03.02 3.023.0 3.0 n/a n/a1 1 n/a n/a-
wrap n/a3.0 3.0 n/a4.0 4.0 n/a n/a n/a n/a n/a n/a-

MethodJavaScriptJScriptNIEOperaNESECMADOMCSSHTMLNotes
handleEvent()1.2 1.2 n/a4.0 4.0 n/a n/a n/a n/a n/a n/a n/a-
select()1.0 1.01.0 1.02.0 2.03.02 3.023.0 3.0 n/a n/a1 1 n/a n/a-

Event nameJavaScriptJScriptNIEOperaNESECMADOMCSSHTMLNotes
onAfterUpdate n/a3.0 3.0 n/a4.0 4.0 n/a n/a n/a n/a n/a n/a-
onBeforeUnload n/a3.0 3.0 n/a4.0 4.0 n/a n/a n/a n/a n/a n/a-
onBeforeUpdate n/a3.0 3.0 n/a4.0 4.0 n/a n/a n/a n/a n/a n/a-
onBlur1.1 1.13.0 3.03.0 3.04.0 4.03.0 3.0 n/a n/a n/a n/a n/aWarning
onChange1.0 1.03.0 3.02.0 2.04.0 4.03.0 3.0 n/a n/a n/a n/a n/a-
onDragStart n/a3.0 3.0 n/a4.0 4.0 n/a n/a n/a n/a n/a n/a-
onErrorUpdate n/a3.0 3.0 n/a4.0 4.0 n/a n/a n/a n/a n/a n/a-
onFilterChange n/a3.0 3.0 n/a4.0 4.0 n/a n/a n/a n/a n/a n/a-
onFocus1.0 1.03.0 3.02.0 2.04.0 4.03.0 3.0 n/a n/a n/a n/a n/aWarning
onHelp n/a3.0 3.0 n/a4.0 4.0 n/a n/a n/a n/a n/a n/aWarning
onKeyDown1.2 1.23.0 3.04.0 4.04.0 4.03.0 3.0 n/a n/a n/a n/a4.0 4.0Warning
onKeyPress1.2 1.23.0 3.04.0 4.04.0 4.03.0 3.0 n/a n/a n/a n/a4.0 4.0Warning
onKeyUp1.2 1.23.0 3.04.0 4.04.0 4.03.0 3.0 n/a n/a n/a n/a4.0 4.0Warning
onMouseDown1.2 1.23.0 3.04.0 4.04.0 4.03.0 3.0 n/a n/a n/a n/a4.0 4.0Warning
onMouseMove1.2 1.23.0 3.04.0 4.04.0 4.0 n/a n/a n/a n/a n/a4.0 4.0Warning
onMouseOut1.1 1.13.0 3.03.0 3.04.0 4.03.0 3.0 n/a n/a n/a n/a4.0 4.0Warning
onMouseOver1.0 1.01.0 1.02.0 2.03.02 3.023.0 3.0 n/a n/a n/a n/a4.0 4.0Warning
onMouseUp1.2 1.23.0 3.04.0 4.04.0 4.03.0 3.0 n/a n/a n/a n/a4.0 4.0Warning
onRowEnter n/a3.0 3.0 n/a4.0 4.0 n/a n/a n/a n/a n/a n/a-
onRowEnter?1.0 1.01.0 1.02.0 2.03.02 3.023.0 3.0 n/a n/a1 1 n/a n/a-
onRowExit n/a3.0 3.0 n/a4.0 4.0 n/a n/a n/a n/a n/a n/a-
onScroll n/a3.0 3.0 n/a4.0 4.0 n/a n/a n/a n/a n/a n/a-
onSelect1.0 1.03.0 3.02.0 2.04.0 4.03.0 3.0 n/a n/a n/a n/a n/a-
onSelectStart n/a3.0 3.0 n/a4.0 4.0 n/a n/a n/a n/a n/a n/a-

Inheritance chain:

Element object, Input object, Node object