Framify

Tag: <select>

<select> Syntax

Syntax Diagram for <select>
Opening Tag Content Closing
Tag
Open Parameter = Value Close
<select name = "name" > option
list
</select>
size = lines
multiple

Syntax Diagram for <option>
Opening Tag Content
Open Parameter = Value Close
<option value = "value" > option
selected

<select> Description

The <select> input element of a <form> is a one-of-many (if multiple was not specified) or n-of-many (if multiple was specified) selection mechanism.
name
Specifies the name of the field, so the handling script can associate the field name and its value.
size
Specifies the height, expressed in lines of text, of the selection list. This is not a logical size, but just an apparent size--entries will automatically scroll on and off the top and bottom of the list as the scroll bar is moved. Default is 1. If size=1, the list is presented as a pop-up menu; if size>1, the list is presented as a vertical list with a scroll bar.
multiple
Specifies whether or not the scrolling list allows multiple items to be selected simultaneously.
value
Allows an alternate value to be passed to the processing script (see the "President" example below). If a value is not specified, the value passed to the processing script is option.
selected
Specifies that the given option is to be preselected, to give the user a default value for the selection.
See also the <form> tag, as well as <input> and <textarea>.

<select> Examples

This markup: <form method="POST" action="http://www.arnspub.com/QuickRef/QRSelect.cgi"> Favorite Color: <select name="Color"> <option>Red <option>Orange <option>Yellow <option>Green <option selected>Blue <option>Indigo <option>Violet </select><br> Choose a President: <select name="President" size=3> <option value="Washington">George Washington <option value="Adams">John Adams <option value="Jefferson" selected>Thomas Jefferson <option value="Madison">James Madison <option value="Monroe">James Monroe <option value="Adams">John Quincy Adams </select><br> Select the noble gases: <select name="Gases" size=5 multiple> <option>Hydrogen <option>Helium <option>Nitrogen <option>Oxygen <option>Fluorine <option selected>Neon <option>Chlorine <option selected>Argon <option>Krypton <option>Xenon <option>Radon </select><br> <input value=" Reset Fields " type=reset> <input type=submit name=SubmitBtn value=" Submit Form "> </form> . . .causes these results:
Favorite Color:
Choose a President:
Select the noble gases:

Last Modified: Thursday, 24-Dec-2009 14:41:49 MST