The Select Widget
The previous select widget was created using the code shown below:
<FORM> <SELECT NAME = "fruit"> <OPTION VALUE = "Apples">Apples <OPTION VALUE = "Oranges">Oranges <OPTION VALUE = "Pears">Pears </SELECT> </FORM>
| Note that the VALUE attribute of the <OPTION> tag is optional. If you do not include it, the value will be taken from the text that follows the tag. |
fruit=Oranges
| Attribute | Description |
|---|---|
| NAME | Specifies what name the browser should use for the name/value pair sent in the HTTP body |
| SIZE | Specifies the number of choices that should be visible to the user |
| SELECTED | Specifies the choice that is selected by default |
| MULTIPLE | Specifies that the user should be able to select multiple items in the list |
| VALUE | Specifies the valueof a choice |
The SIZE Attribute
<FORM> <SELECT NAME = "fruit" SIZE = "3"> <OPTION VALUE = "Apples">Apples <OPTION VALUE = "Oranges">Oranges <OPTION VALUE = "Pears">Pears <OPTION VALUE = "Banana">Banana </SELECT> </FORM>
The SELECTED Attribute
<FORM> <SELECT NAME = "fruit" SIZE = "3"> <OPTION VALUE = "Apples">Apples <OPTION VALUE = "Oranges">Oranges <OPTION VALUE = "Pears" SELECTED>Pears <OPTION VALUE = "Banana">Banana </SELECT> </FORM>
The MULTIPLE Attribute
<FORM> <SELECT NAME = "fruit" SIZE = "4" MULTIPLE> <OPTION VALUE = "Apples">Apples <OPTION VALUE = "Oranges">Oranges <OPTION VALUE = "Pears">Pears <OPTION VALUE = "Banana">Banana </SELECT> </FORM>