File: select.html

package info (click to toggle)
wdg-html-reference 4.0-2
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 4,528 kB
  • ctags: 305
  • sloc: makefile: 39
file content (75 lines) | stat: -rw-r--r-- 8,359 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN"
   "http://www.w3.org/TR/REC-html40/strict.dtd">
<html lang=en>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>SELECT - Option Selector</title>
<link rev=Made href="mailto:liam@htmlhelp.com">
<link rel=Start href="../index.html">
<link rel=StyleSheet href="../style.css" type="text/css">
<link rel=StyleSheet href="../aural.css" type="text/css" media=aural>
<meta name="author" content="Liam Quinn">
<meta name="description" content="A description of HTML 4.0's SELECT element for the selection of options in a form.">
<meta name="keywords" content="SELECT, select element, select box, selection, drop-down list, list box, drop-down menu, forms, form, HyperText Markup Language, HTML, HTML4, HTML 4.0, Web Design Group, WDG, &lt;select&gt; tag, &lt;SELECT&gt; tag">
</head>
<body>
<h2><img src="../wdglogo1.gif" width=250 height=83 alt="The Web Design Group"></h2>
<h1>SELECT - Option Selector</h1>
<table>
  <tr valign=top>
    <th>Syntax</th>
    <td><strong class=required>&lt;SELECT&gt;</strong>...<strong class=required>&lt;/SELECT&gt;</strong></td>
  </tr>
  <tr valign=top>
    <th>Attribute Specifications</th>
    <td>
      <ul>
        <li>NAME=<var><a href="../values.html#cdata">CDATA</a></var> (key in submitted form)</li>
        <li>MULTIPLE (allow multiple selections)</li>
        <li>SIZE=<var><a href="../values.html#number">Number</a></var> (number of visible options)</li>
        <li>DISABLED (disable element)</li>
        <li>TABINDEX=<var><a href="../values.html#number">Number</a></var> (position in tabbing order)</li>
        <li>ONFOCUS=<var><a href="../values.html#script">Script</a></var> (element received focus)</li>
        <li>ONBLUR=<var><a href="../values.html#script">Script</a></var> (element lost focus)</li>
        <li>ONCHANGE=<var><a href="../values.html#script">Script</a></var> (element value changed)</li>
        <li><a href="../attrs.html">common attributes</a></li>
      </ul>
    </td>
  </tr>
  <tr valign=top>
    <th>Contents</th>
    <td>One or more <a href="optgroup.html">OPTGROUP</a> or <a href="option.html">OPTION</a> elements</td>
  </tr>
  <tr valign=top>
    <th>Contained in</th>
    <td><a href="../block.html">Block-level elements</a>, <a href="../inline.html">inline elements</a> except <a href="button.html">BUTTON</a></td>
  </tr>
</table>
<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>, HTML4.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>&lt;P&gt;Select one or more sections to search:<br><strong>&lt;SELECT NAME=sections MULTIPLE&gt;</strong><br>&lt;OPTION&gt;Web Authoring Reference&lt;/OPTION&gt;<br>&lt;OPTION&gt;FAQ Archives&lt;/OPTION&gt;<br>&lt;OPTION&gt;Design Elements&lt;/OPTION&gt;<br>&lt;OPTION&gt;Tools&lt;/OPTION&gt;<br>&lt;OPTION&gt;Feature Article&lt;/OPTION&gt;<br><strong>&lt;/SELECT&gt;</strong><br>&lt;/P&gt;</code></p>
<p>The boolean <strong class=html>DISABLED</strong> attribute, new in HTML4.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> HTML4.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> HTML3.2 Recommendation</a></li>
  <li><a href="http://www.w3.org/MarkUp/html-spec/html-spec_8.html#SEC8.1.3">SELECT in HTML2.0 Standard</a></li>
  <li><a href="../../wilbur/form/select.html">SELECT in <abbr class=initialism title="Web Design Group">WDG</abbr> HTML3.2 Reference</a></li>
  <li><a href="http://www.malibutelecom.com/yucca/HTML3.2/5.47.html">SELECT in <cite>Learning HTML3.2 by Examples</cite></a></li>
</ul>
<div class=footer>
<address>Maintained by <a href="http://www.htmlhelp.com/%7Eliam/">Liam Quinn</a> &lt;<a href="mailto:liam@htmlhelp.com">liam@htmlhelp.com</a>&gt;</address>
<p class=toolbar><img src="../wdglogo-small.gif" width=105 height=40 alt="Web Design Group ~"> <a href="../index.html" rel=Start>HTML4.0Reference</a>~ <a href="../olist.html">ElementsbyFunction</a>~ <a href="../alist.html">ElementsAlphabetically</a></p>
<p class=copyright>Copyright &copy; 1998 by <a href="http://www.htmlhelp.com/%7Eliam/">Liam Quinn</a>. This material may be distributed only subject to the terms and conditions set forth in the Open Publication License, v1.0 or later (the latest version is presently available at <a href="http://www.opencontent.org/openpub/">http://www.opencontent.org/openpub/</a>).</p>
</div>
</body>
</html>