<option> ... </optiona>
Available in versions: 2.0, 3.2, 4.0
The <option> tag is used to insert one item in a pull-down form control.
You may repeat this tag an unlimited number of times in a pull-down list.
(For example, you could list all fifty states.)
By default, when an item is chosen, the value that is added to the contents of the
form is the text that appears immediately after the opening option tag.
However, you can specify a different value by using the value attribute.
This tag must be placed between the opening and closing select tags.
The order of the option tags determines the default order of the list.
However, you can use the selected attribute to specify one item
always to appear at the top of the list.
In general, a pull-down list should be treated as a menu.
It is recommended that the text for each item in the list be short,
such as one or two words.
A long text can be far too unwieldy to read and will probably annoy most users.
The ending tag is optional.
However, it is recommended that it be included.
Core Attributes
class
dir
id
lang
onclick
ondblclick
onkeydown
onkeypress
onkeyup
onmousedown
onmousemove
onmouseout
onmouseover
onmouseup
style
title
Attributes
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.
label
The label attribute is used create a short text version of the text that
appears after the opening option tag.
selected
The selected attribute is used to specify which one item in the pull-down
will appear at the top of the list.
Some browsers highlight the selected item.
The default is that the list is in the same order as the option tags
and there is no highlighting
value
The value attribute is used when you need to set a different value for
the item in the pull-down that what is listed in the option tag.
Code:
<select size="2">
<option selected>Angel fish</option>
<option>Cardinal tetra</option>
<option>Cat fish</option>
<option>Discus</option>
<option>Hatchet fish</option>
<option>Neon tetra</option>
</select>
Output:
Copyright 2000 by Infinite Software
Solutions, Inc.
Trademark Information
|