The <TEXTAREA> Element Another popular text control is the text area control, whichunlike the other text controls we've seen so far in this chapterenables you to handle multiple lines of text. You can see the properties, methods , and events of the <TEXTAREA> element in overview in Table 13.5, its properties in depth in Table 13.6, its methods in Table 13.7, and its events in Table 13.8. Also see Chapters 5 and 6 for the JavaScript core HTML properties, methods, and events that also apply to this element. Table 13.5. Overview of the Properties, Methods, and Events of the <TEXTAREA> Element (See Chapters 5 and 6 for the JavaScript core HTML properties, methods, and events that also apply to this element.) Properties | Methods | Events | cols | createTextRange | onafterupdate | form | select | onbeforeupdate | name | | onchange | readOnly | | onerrorupdate | rows | | onselect | type | | | wrap | | | Table 13.6. The Properties of the <TEXTAREA> Element (See Chapters 5 and 6 for the JavaScript core HTML properties, methods, and events that also apply to this element.) Property | NS2 | NS3 | NS4 | NS6 | IE3a | IE3b | IE4 | IE5 | IE5.5 | IE6 | cols | | | | x | | | x | x | x | x | | Read/write | | Holds the number of columns in the text area, corresponding to the COLS property. Set to an integer. | form | x | x | x | x | x | x | x | x | x | x | | Read-only | | Contains a reference to the control's form. This is handy if you pass a control to a function and need access to other controls in the same form. | name | x | x | x | x | x | x | x | x | x | x | | Read/write | | Holds the name of the control, as used in code. May be changed in code, because it's read/write. Set to a name string. | readOnly | | | | x | | | x | x | x | x | | Read/write | | Specifies whether the control is read-only. Set to true or false. This property is useful to "disable" text controls (although you also can use the disabled property). If you're just using a text control to display text, however, consider using a <DIV> or <SPAN> element with the innerHTML property instead. | rows | | | | x | | | x | x | x | x | | Read/write | | Holds the number of rows in the text area, corresponding to the ROWS property. Set to an integer. | type | | x | x | x | | x | x | x | x | x | | Read-only | | Holds a string that indicates the type of the control. Holds "textarea" here. | wrap | | | | | | | x | x | x | x | | Read/write | | Specifies how to handle word wrapping at the ends of lines. Set to a string; the possible values are: "soft" (the defaulttext displays with word wrapping and is submitted without carriage returns and line feeds), "hard" (text displays with word wrapping and is submitted with returns and line feeds), and "off" (word wrapping is disabled). | Table 13.7. The Methods of the <TEXTAREA> Element (See Chapters 5 and 6 for the JavaScript core HTML properties, methods, and events that also apply to this element.) Method | NS2 | NS3 | NS4 | NS6 | IE3a | IE3b | IE4 | IE5 | IE5.5 | IE6 | createTextRange | | | | | | | x | x | x | x | | Returns: TextRange object | | This method creates a TextRange object for the control. | | Syntax: createTextRange() . See Chapter 11 for more on text ranges. | select | x | x | x | x | x | x | x | x | x | x | | Returns: Nothing | | Selects the text in the control. | | Syntax: select() . You can use this method together with the focus method (see Chapter 6) to highlight text and set yourself up for a response from the user . | Table 13.8. The Events of the <TEXTAREA> Element (See Chapters 5 and 6 for the JavaScript core HTML properties, methods, and events that also apply to this element.) Event | NS2 | NS3 | NS4 | NS6 | IE3a | IE3b | IE4 | IE5 | IE5.5 | IE6 | onafterupdate | | | | | | | x | x | x | x | | Occurs in a data-bound object after updating the data in the data source. | onbeforeupdate | | | | | | | x | x | x | x | | Occurs in a data-bound object before updating the data in the data source. | onchange | x | x | x | x | x | x | x | x | x | x | | Occurs when the user has changed the contents of a text control and then leaves the control by setting the focus somewhere else (such as by clicking another control). In other words, the user has "committed" the change by moving away from the controlthis event does not happen while the user is entering text. (For that, see onkeydown , onkeypress , and onkeyup in Chapter 6.) See "Using Text Controls" in this chapter. | onerrorupdate | | | | | | | x | x | x | x | | Occurs in a data-bound object when an error happened while updating data in the data source. | onselect | | | | x | x | x | x | x | x | x | | Occurs when text in the control is selected. See "Using Text Areas" in this chapter for an example. | |