Programming |  HTML Programming |  HTML Forms |  Textarea

Text areas are used for multiple-line text entry. The default size of the text box is 1 row by 20 characters. You can change the size using the COLS and ROWS attributes. Here's a typical example of a text area with a text box 40 characters wide by 7 rows:

    <TEXTAREA NAME="myarea" COLS="40" ROWS="7">
    </TEXTAREA>

The text area can be initialized by placing the initial text between the tags:

    <TEXTAREA NAME="myarea" COLS="40" ROWS="7">
    Initial text
    </TEXTAREA>

You can use JavaScript to read the contents of the text area box. This is done with the value property. Here is an example:

    <SCRIPT LANGUAGE="JavaScript">
    function seeTextArea (form) {
        alert (form.myarea.value);
    }
    </SCRIPT>