Magazine |
| | Community |
| | Workshop |
| | Tools & Samples |
| | Training |
| | Site Info |
|
|
||||||||
|
Denotes a list box or drop-down list.
HTML Syntax
<SELECT ACCESSKEY=key ALIGN=ABSBOTTOM | ABSMIDDLE | BASELINE | BOTTOM | LEFT | MIDDLE | RIGHT | TEXTTOP | TOP CLASS=classname DATAFLD=colname DATASRC=#ID DISABLED ID=value LANG=language LANGUAGE=JAVASCRIPT | JSCRIPT | VBSCRIPT | VBS MULTIPLE NAME=name SIZE=n STYLE=css1-properties TABINDEX=n event = script >
Members
Styles
Example
The following HTML code creates a drop-down list box. The SIZE attribute defaults to 1, so it could be omitted here.
<SELECT NAME="Cats" SIZE="1"> <OPTION VALUE="1">Calico <OPTION VALUE="2">Tortie <OPTION VALUE="3" SELECTED>Siamese </SELECT>The next example creates a multi-select list box by setting the SIZE and MULTIPLE attributes. To retrieve the selected options for a multi-select list box, iterate through the options collection checking for SELECTED set to true.
<SELECT NAME="Cars" SIZE="3" MULTIPLE> <OPTION VALUE="1" SELECTED>BMW <OPTION VALUE="2">PORSCHE <OPTION VALUE="3" SELECTED>MERCEDES </SELECT>The following example adds a new option to the end of an existing SELECT list. In JScript (compatible with ECMA 262 language specification) and Javascript, the new Option constructor can also be used.
var oOption = document.createElement("OPTION"); oOption.text="Apples"; oOption.value="5"; document.all.oMyList.add(oOption);
See Also
Does this content meet your programming needs? Write us!
© 1998 Microsoft Corporation. All rights reserved. Terms of use.