JavaScript 16: The TextArea Tag

The TEXTAREA is the last input type we shall encounter which can be placed on a form. The TEXTAREA is used for capturing a larger amount of text than is feasible from a TEXT INPUT tag because it can be defined to extend over a number of rows and a number of columns and extends in size almost as far as the user wishes. This example creates a TEXTAREA of 10 rows and 40 columns but with the facility to add as much text as you wish.

<TEXTAREA ROWS=10 COLS= 40>

You cannot output to a TEXTAREA as you can to an INPUT TEXT field but anything you write between the TEXTAREA and /TEXTAREA tags will be placed in the area on screen.

Other tags used with TEXTAREA are:

The following example prompts the user to enter a 'mini saga' in less than 50 words, a challenging exercise of invention and concise expression. The JavaScript code counts the number of spaces to determine whether the entry passes the 50 word test.


Write a 'mini saga' of no more than 50 words into the text box underneath. Click on the buttons to count the words and then submit it.

   

   

   

You wrote words


Return to Javascript Menu