<p>The <strong class=html>SELECT</strong> element defines a form control for the <em>selection of options</em>. While <strong class=html>SELECT</strong> is most useful within a <strong class=html><a href="form.html">FORM</a></strong>, HTMLá4.0 allows <strong class=html>SELECT</strong> in any <a href="../block.html">block-level</a> or <a href="../inline.html">inline</a> element other than <strong class=html><a href="button.html">BUTTON</a></strong>. However, <a href="http://www.netscape.com/navigator/">Netscape Navigator</a> will not display any <strong class=html>SELECT</strong> elements outside of a <strong class=html>FORM</strong>.</p>
<p>The <strong class=html>SELECT</strong> element contains one or more <strong class=html><a href="optgroup.html">OPTGROUP</a></strong> or <strong class=html><a href="option.html">OPTION</a></strong> elements to provide a menu of choices for the user. Each choice is contained within an <strong class=html>OPTION</strong> element. Choices can be grouped logically through the <strong class=html>OPTGROUP</strong> element. <strong class=html>SELECT</strong>'s <strong class=html>NAME</strong> attribute provides the key sent to the server with the value of the selected option.</p>
<p>By default, the user can only select one option. The boolean <strong class=html>MULTIPLE</strong> attribute allows the user to select multiple options, which are submitted as separate name/value pairs. The following example uses the <strong class=html>MULTIPLE</strong> attribute to allow the selection of one or more options:</p>
<p class=example><code class=html><P>Select one or more sections to search:<br><strong><SELECT NAME=sections MULTIPLE></strong><br><OPTION>Web Authoring Reference</OPTION><br><OPTION>FAQ Archives</OPTION><br><OPTION>Design Elements</OPTION><br><OPTION>Tools</OPTION><br><OPTION>Feature Article</OPTION><br><strong></SELECT></strong><br></P></code></p>
<p>The boolean <strong class=html>DISABLED</strong> attribute, new in HTMLá4.0 and poorly supported by current browsers, makes the <strong class=html>SELECT</strong> element unavailable. The user is unable to edit the disabled selection, no value is submitted with the form, the <strong class=html>SELECT</strong> element cannot receive focus, and the element is skipped when navigating the document by tabbing.</p>
<p>The <strong class=html>TABINDEX</strong> attribute specifies a number between 0 and 32767 to indicate the tabbing order of the element. A <strong class=html>SELECT</strong> element with <strong class=html>TABINDEX=0</strong> or no <strong class=html>TABINDEX</strong> attribute will be visited after any elements with a positive <strong class=html>TABINDEX</strong>. Among positive <strong class=html>TABINDEX</strong> values, the lower number receives focus first. In the case of a tie, the element appearing first in the <abbr class=initialism title="HyperText Markup Language">HTML</abbr> document takes precedence.</p>
<p>The <strong class=html>SIZE</strong> attribute of <strong class=html>SELECT</strong> hints that visual browsers should display the element as a list box with the specified number of options visible at any time. A scroll bar would allow access to any non-visible options. The <strong class=html>SIZE</strong> attribute is especially useful in <strong class=html>SELECT</strong> elements with numerous <strong class=html>OPTION</strong>s and multiple selections allowed. In such a situation, some visual browsers will render the entire list in one large box without scrolling; a suitable <strong class=html>SIZE</strong> attribute helps such browsers give a more appropriate presentation.</p>
<p>The <strong class=html>SELECT</strong> element also takes a number of attributes to specify client-side scripting actions for various events. In addition to the <a href="../attrs.html#events">core events</a> common to most elements, <strong class=html>SELECT</strong> accepts the following event attributes:</p>
<ul>
<li><strong class=html>ONFOCUS</strong>, when the element receives focus;</li>
<li><strong class=html>ONBLUR</strong>, when the element loses focus;</li>
<li><strong class=html>ONCHANGE</strong>, when the element loses focus and its value has changed since it received focus.</li>
</ul>
<h2>More Information</h2>
<ul>
<li><a href="http://www.w3.org/TR/REC-html40/interact/forms.html#edef-SELECT">SELECT in <abbr class=initialism title="World Wide Web Consortium">W3C</abbr> HTMLá4.0 Recommendation</a></li>
<li><a href="http://www.w3.org/TR/REC-html32#select">SELECT in <abbr class=initialism title="World Wide Web Consortium">W3C</abbr> HTMLá3.2 Recommendation</a></li>
<li><a href="http://www.w3.org/MarkUp/html-spec/html-spec_8.html#SEC8.1.3">SELECT in HTMLá2.0 Standard</a></li>
<li><a href="http://www.htmlhelp.com/reference/wilbur/form/select.html">SELECT in <abbr class=initialism title="Web Design Group">WDG</abbr> HTMLá3.2 Reference</a></li>
<li><a href="http://www.hut.fi/u/jkorpela/HTML3.2/5.47.html">SELECT in <cite>Learning HTMLá3.2 by Examples</cite></a></li>
</ul>
<div class=footer>
<address>Maintained by <a href="http://www.htmlhelp.com/%7Eliam/">Liam Quinn</a> <<a href="mailto:liam@htmlhelp.com">liam@htmlhelp.com</a>></address>