Creating a selection list

To create a selection list, use the following list of HTML tags:

<select name="name" size="size" multiple="multiple">
<option> item1 </option>
<option> item2 </option>
<option> item3 </option>
. . . . . . . .
</select>

where size attribute specifies the number of items to display within the list box at any one time (the default is "1"), and the multiple attribute indicates whether the user can select multiple items from the selection list.

The following selection list is used in the next examples:

HTML tags
Select a color:<br />
<select>
<option> black   </option>
<option> green   </option>
<option> brown   </option>
<option> red     </option>
<option> blue    </option>
<option> white   </option>
<option> yellow  </option>
<option> pink    </option>
<option> magenta </option>
<option> cyan    </option>
</select>

Below is the selection list layout corresponding to various attribute settings:

no attributes
Select a color:
size="3"
Select a color:
size="5" multiple="multiple"
Select a color:



Try how it works:

Input formHTML code

Select a color:

   

<form method="post" action="/cgi-bin/sb/CheckData">
Select a color:<br />
<select name="sel" size="4">
<option> black   </option>
<option> green   </option>
<option> brown   </option>
<option> red     </option>
<option> blue    </option>
<option> white   </option>
<option> yellow  </option>
<option> pink    </option>
<option> magenta </option>
<option> cyan    </option>
</select> 
<p> <input type="submit" /> <input type="reset" /></p>
</form>