HTML and CSS Reference
In-Depth Information
.
Output
FIGURE 11.14
You can use
select
form
controls to create
pull-down menus.
To create a scrollable list of items, just include the
size
attribute in the opening
select
tag, like this:
Input
▼
<select name=“location” size=“3”>
Figure 11.15 shows the same
select
element as Figure 11.14, except that the
size
attribute is set to
3
. Setting the size to
3
indicates that the browser should display three
options simultaneously.
11
.
Output
FIGURE 11.15
You also can
create scrollable
lists using the
select
element.
To see the fourth item, the user would have to use the scrollbar built in to the select list.
By default, the value inside the
<option>
tag specifies both what is displayed in the form
and what's sent back to the server. To send a value other than the display value to the
server, use the
value
attribute. The following code, for example, causes
bw499
to be sub-
mitted to the server as the value associated with the
Courses
field instead of
Basket
Weaving 499
:
<select name=“courses”>
<option value=“p101”>
Programming 101
</option>
<option value=“e312”>
Ecomomics 312
</option>
<option value=“pe221”>
Physical Education 221
</option>
<option value=“bw499”>
Basket Weaving 499
</option>
</select>