Name
<LABEL> — NN n/a IE 4 HTML 4
Synopsis
<LABEL>...</LABEL>
End Tag: Required
The LABEL
element defines a structure
and container for the label associated with an
INPUT
element. Because the rendered labels for
most form controls are not part of the element’s tag, the
LABEL
attribute provides a way for a browser to
clearly link label content to the control.
You have two ways to provide the association. One is to assign the
ID
attribute value of the control to the
FOR
attribute of the LABEL
element. The other is to wrap the INPUT
element
inside a LABEL
element. The latter is possible
only if the label and control are part of running body content; if
you must physically separate the label from the control because they
exist inside separate TD
elements of a table, you
must use the FOR
attribute linkage. Whether the
label is rendered in front of or after the control depends entirely
on the relative locations of the tags in the source code. A future
application for this element is for text-to-speech browsers reading
aloud the label for a control.
Example
<FORM> <LABEL>Company:<INPUT TYPE="text" NAME="company"></LABEL><BR> <LABEL FOR="stateEntry">State:</LABEL> <INPUT TYPE="text" NAME="state" ID="stateEntry"> ... </FORM>
Object Model Reference
- IE
[window.]document.all.elementID
Attributes
|
|
|
|
|
|
|
|
|
|
|
|
|
Event Handler Attributes
Handler |
NN |
IE |
HTML |
---|---|---|---|
onBlur |
n/a |
n/a |
4 |
Get Dynamic HTML: The Definitive Reference now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.