
|
 |
 |

The <SELECT>...</SELECT> tag is used to include pull-down menus in your forms. Pull-down menus can work like the radio buttons (where only one selection is allowed) or like checkboxes (where more then one selection is allowed), and it is in a small convenient space saver package. Pull-down menus can also serve as a substitute from text fields, since it can be more user-friendly than having the user type in a response. These are just some of the few reasons why you might want to use a pull-down menu in your forms.
The NAME attribute assigns a name to this input field. The program you will use to process this information will need to know the name of the field.
The SIZE attribute displays the number of items that you place for the value. There are times when you would like your visitor to be able to view all the options on the page without having actually pulldown the menu.
The MULTIPLE attribute allows you to make more than one selection.
OPTION
The <SELECT> tag defines the menu, but you will need to nest the <OPTION>...</OPTION> tags inside to define the actual items that will appear in the pull-down menu. In-between the <OPTION> tags you will type in what you want to be displayed in the menu. The <OPTION> tag has it's own set of attributes.
The VALUE attribute sends it's value to the CGI script if it is selected.
The SELECTED attribute doesn't have a value and is used to set an item to be selected as the default.
Here is the code for an example of a pull-down menu:
<FORM ACTION="#">
Do you like any of these foods?<BR>
<SELECT NAME="health" SIZE="2" MULTIPLE>
<OPTION VALUE="tofu" SELECTED> Tofu </OPTION>
<OPTION VALUE="soybeans"> Soybeans </OPTION>
</SELECT><BR><BR>
What type of milk do you drink?<BR>
<SELECT NAME="milk" SIZE="1">
<OPTION VALUE="whole"> Whole Milk </OPTION>
<OPTION VALUE="2"> 2% Milk </OPTION>
<OPTION VALUE="1" SELECTED> 1% Milk </OPTION>
</SELECT>
</FORM>
Here is how it will look:
© Copyright 2000-2002 by Pepmint.com. All Rights Reserved |
 |
 |
|