To create a selection list, use the following list of HTML tags:
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:
Try how it works:
Input form | HTML code |
---|---|
<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> |