SELECT Element | SELECT Object
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 >
Remarks
The SELECT element is an inline element and requires a closing tag.
This element is available in HTML and script as of Microsoft® Internet Explorer 3.0.
Members
Styles
Example
This example uses the SELECT element to create a drop-down list box.
<SELECT NAME="Cats" SIZE="1"> <OPTION VALUE="1">Calico <OPTION VALUE="2">Tortie <OPTION VALUE="3" SELECTED>Siamese </SELECT>This example uses the SELECT element to create 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 and check to see where SELECTED is set to true.
<SELECT NAME="Cars" SIZE="3" MULTIPLE> <OPTION VALUE="1" SELECTED>BMW <OPTION VALUE="2">PORSCHE <OPTION VALUE="3" SELECTED>MERCEDES </SELECT>This example adds a new option to the end of an existing SELECT list. The new Option constructor can also be used in Microsoft® JScript® (compatible with ECMA 262 language specification).
<SCRIPT LANGUAGE="JScript"> var oOption = document.createElement("OPTION"); oOption.text="Apples"; oOption.value="5"; document.all.oMyList.add(oOption); </SCRIPT>
See Also
Did you find this topic useful? Suggestions for other topics? write us!
© 1999 microsoft corporation. all rights reserved. terms of use.