HTML and CSS Reference
In-Depth Information
Figure 11.31 The user enters a password that isn't correct and receives the alert
The textarea Object. If you don't have enough room to say it all in a text field, then
you can use the text area box for multiple lines of input. The textarea object parallels the
HTML <textarea> tag. The number of characters in a line is specified with the cols attri-
bute of the <textarea> tag, and the number of rows in the box is specified by the rows
attribute. If the wrap attribute is defined, when the user reaches the end of a line, a new-
line will be inserted and the input will start on the next line; otherwise a scrollbar will
appear. The textarea object, like the text object, has a number of properties and methods
that make it possible to access and change the text area from within a JavaScript pro-
gram. These are shown in Tables 11.13 and 11.14.
To reference a text area box from JavaScript, you go down the document tree, starting
at the document , then to the form , and then the textarea element. To get a value in the
text area box, for example, you would use document.form1.textarea1.value , where form1
is the name of the form, and textarea1 is the name of the text area. Figure 11.32 shows
the JavaScript object hierarchy for the textarea object.
Search WWH ::

Custom Search