form tag
button tag
input tag
select tag
optgroup tag
option tag
TAG: textarea
<textarea> ... </textarea>
Available in versions: 2.0, 3.2, 4.0
Browser compatibility: Explorer 4, 5 Netscape 4, 6
The
<textarea>
tag is used to create a multi-line text input window form control (field). Control is a technical term that refers to the various elements (buttons, check boxes, radio buttons, text areas) that can be used inside a form to gather information.
The four tags that can be used to build a
form
are:
button
input
select
textarea
The
textarea
control should be used when the user needs to input more than one line of data. If you only expect the user to input a few words, you should use the
input
tag with
type="text"
control that creates a one line text input window.
Any text or HTML code that occurs between the opening and closing
textarea
tags will appear inside the textarea window. Therefore, the closing tag is mandatory.
Core Attributes
class
dir
id
lang
onclick
ondblclick
onkeydown
onkeypress
onkeyup
onmousedown
onmousemove
onmouseout
onmouseover
onmouseup
style
title
Attributes
accesskey
The
accesskey
attribute allows you to designate a key on the keyboard that when pressed, along with the alt or meta key, will bring focus to the
textarea
element. This attribute is poorly supported.
cols
The
cols
attribute sets how many characters will be visible across the width of the
textbox
window.
disabled
The
disabled
attribute is a Boolean value that, if present, prevents the form control (field) from functioning. In some browsers, the control (field) will appear to be greyed out.
name
The
name
attribute is a string of characters that is used to label a form control (field) with a name. The name must be unique to that document and cannot be reused.
onblur
The
onblur
attribute is an event that allows the execution of JavaScript code when an element loses focus (for example, the mouse was clicked onto another element or a tab navigation directed the cursor elsewhere).
onchange
The
onchange
attribute is an event that allows the execution of JavaScript code when the form control (field) has been changed and loses focus.
onfocus
The
onfocus
attribute is an event that allows the execution of JavaScript code when an element comes into focus (for example, the mouse was clicked onto the element or a tab navigation brought the cursor to the element).
onselect
The
onselect
attribute is an event that allows the execution of JavaScript code when the form control (field) gains focus.
readonly
The
readonly
attribute allows you to display a text or value in a form control (field) that cannot be changed by the user.
rows
The
rows
attribute sets how many rows will be displayed in the
textarea
window.
tabindex
The
tabindex
attribute specifies an integer that defines the rank in the tabbing order for the specified element when you use the keyboard to navigate (tab through) a page. This attribute is poorly supported.
wrap
The
wrap
attribute allows a text that is longer than the window size to be displayed on more than one line. This is called wrapping. The default is to not wrap. Permitted values are
off
(default),
physical
, and
virtual
. This is a Netscape proprietary attribute and is not part of version 4.01.
This example shows two
textarea
windows, the first is not sized and the second is sized.
Code:
<form action="html_textarea.html" method="post">
<textarea name="textarea12">
This is the default size.
</textarea>
<br>
<textarea cols="45" rows="4" name="textarea13">
</textarea>
</form>
Output:
This is the default size.
Copyright 1999-2001 by Infinite Software Solutions, Inc. All rights reserved.
Trademark Information