home *** CD-ROM | disk | FTP | other *** search
/ Computer Shopper 133 / dpcs0399.iso / INTERNET / COFFEE / HTMLED55 / SETUP.EXE / file0129.bin < prev    next >
Encoding:
Text File  |  1998-11-04  |  7.8 KB  |  94 lines

  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN"
  2.    "http://www.w3.org/TR/REC-html40/strict.dtd">
  3. <html lang=en>
  4. <head>
  5. <title>OPTION - Menu Option</title>
  6. <link rev=Made href="mailto:liam@htmlhelp.com">
  7. <link rel=Start href="../index.html">
  8. <link rel=Glossary href="http://www.htmlhelp.com/glossary/glossary.html">
  9. <link rel=Copyright href="http://www.htmlhelp.com/copyright.html">
  10. <link rel=StyleSheet href="../style.css" type="text/css">
  11. <link rel=StyleSheet href="../aural.css" type="text/css" media=aural>
  12. <meta name="author" content="Liam Quinn">
  13. <meta name="description" content="A description of HTML 4.0's OPTION element for menu options in a form.">
  14. <meta name="keywords" content="OPTION, option element, select option, drop-down option, list box item, menu option, menu item, forms, form, HyperText Markup Language, HTML, HTML4, HTML 4.0, Web Design Group, WDG, <option> tag, <OPTION> tag">
  15. </head>
  16. <body>
  17. <h2><img src="../wdglogo1.gif" width=250 height=83 alt="The Web Design Group"></h2>
  18. <h1>OPTION - Menu Option</h1>
  19. <table>
  20.   <tr valign=top>
  21.     <th>Syntax</th>
  22.     <td><strong class=required><OPTION></strong>...</OPTION></td>
  23.   </tr>
  24.   <tr valign=top>
  25.     <th>Attribute Specifications</th>
  26.     <td>
  27.       <ul>
  28.         <li>VALUE=<var><a href="../values.html#cdata">CDATA</a></var> (value of option)
  29.         <li>SELECTED (choice initially selected)</li>
  30.         <li>DISABLED (disable choice)</li>
  31.         <li>LABEL=<var><a href="../values.html#text">Text</a></var> (option label)</li>
  32.         <li><a href="../attrs.html">common attributes</a></li>
  33.       </ul>
  34.     </td>
  35.   </tr>
  36.   <tr valign=top>
  37.     <th>Contents</th>
  38.     <td>Plain text (including <a href="../entities/index.html">entities</a>)</td>
  39.   </tr>
  40.   <tr valign=top>
  41.     <th>Contained in</th>
  42.     <td><a href="select.html">SELECT</a>, <a href="optgroup.html">OPTGROUP</a></td>
  43.   </tr>
  44. </table>
  45. <p>The <strong class=html>OPTION</strong> element defines a <em>menu choice</em> within a <strong class=html><a href="select.html">SELECT</a></strong> menu. The value of the option, sent with a submitted form, is specified with the <strong class=html>VALUE</strong> attribute. In the absence of a <strong class=html>VALUE</strong> attribute, the value is the content of the <strong class=html>OPTION</strong> element.</p>
  46. <p>The boolean <strong class=html>SELECTED</strong> attribute defines the <strong class=html>OPTION</strong> to be initially selected. A <strong class=html>SELECT</strong> element can only have one <strong class=html>OPTION</strong> selected at any time unless the <strong class=html>MULTIPLE</strong> attribute is present on <strong class=html>SELECT</strong>.</p>
  47. <div class=note>
  48. <p>If the <strong class=html>SELECT</strong> element does not use the <strong class=html>MULTIPLE</strong> or <strong class=html>SIZE</strong> attributes, some browsers will automatically (and incorrectly) select an option. To ensure that a suitable option is selected, authors may wish to use the <strong class=html>SELECTED</strong> attribute on an <strong class=html>OPTION</strong>. If no option is a suitable default, consider using a dummy option, as in the following example:</p>
  49. <p class=example><code class=html><SELECT NAME="marital_status"><br><OPTION SELECTED VALUE="">Select...</OPTION><br><OPTION>Single</OPTION><br><OPTION>Married</OPTION><br><OPTION>Separated</OPTION><br><OPTION>Divorced</OPTION><br><OPTION>Widowed</OPTION><br></SELECT></code></p>
  50. </div>
  51. <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>OPTION</strong> element unavailable. A disabled option cannot be selected by the user and is never submitted with the form.</p>
  52. <p>The <strong class=html>LABEL</strong> attribute specifies the option label presented to the user. This defaults to the content of the <strong class=html>OPTION</strong> element, but the <strong class=html>LABEL</strong> attribute allows authors to more easily use <strong class=html><a href="optgroup.html">OPTGROUP</a></strong> without sacrificing compatibility with browsers that do not support option groups. The following example illustrates the technique:</p>
  53. <pre class=example><code class=html><P>Which Web browser do you use most often?
  54.   <SELECT NAME=browser>
  55.     <OPTGROUP LABEL="Netscape Navigator">
  56.       <OPTION LABEL="4.x or higher">
  57.         Netscape Navigator 4.x or higher
  58.       </OPTION>
  59.       <OPTION LABEL="3.x">Netscape Navigator 3.x</OPTION>
  60.       <OPTION LABEL="2.x">Netscape Navigator 2.x</OPTION>
  61.       <OPTION LABEL="1.x">Netscape Navigator 1.x</OPTION>
  62.     </OPTGROUP>
  63.     <OPTGROUP LABEL="Microsoft Internet Explorer">
  64.       <OPTION LABEL="4.x or higher">
  65.         Microsoft Internet Explorer 4.x or higher
  66.       </OPTION>
  67.       <OPTION LABEL="3.x">Microsoft Internet Explorer 3.x</OPTION>
  68.       <OPTION LABEL="2.x">Microsoft Internet Explorer 2.x</OPTION>
  69.       <OPTION LABEL="1.x">Microsoft Internet Explorer 1.x</OPTION>
  70.     </OPTGROUP>
  71.     <OPTGROUP LABEL="Opera">
  72.       <OPTION LABEL="3.x or higher">Opera 3.x or higher</OPTION>
  73.       <OPTION LABEL="2.x">Opera 2.x</OPTION>
  74.     </OPTGROUP>
  75.     <OPTION>Other</OPTION>
  76.   </SELECT>
  77. </P></code></pre>
  78. <p><strong class=html>OPTGROUP</strong> and <strong class=html>OPTION</strong>'s <strong class=html>LABEL</strong> attribute were introduced together, so browsers should support both features or neither of them. Supporting browsers will render the preceding example using the <strong class=html>LABEL</strong> attribute of <strong class=html>OPTION</strong> to provide just the version number, along with the <strong class=html>OPTGROUP</strong>'s <strong class=html>LABEL</strong>, which gives the full name of the application. This allows a compact display with cascading menus, but many browsers do not yet support <strong class=html>OPTGROUP</strong>. These browsers will ignore the <strong class=html>OPTGROUP</strong> elements and <strong class=html>LABEL</strong> attributes, providing the full name and version for each choice. Thus authors can fully use <strong class=html>OPTGROUP</strong> despite its lack of browser support.</p>
  79. <h2>More Information</h2>
  80. <ul>
  81.   <li><a href="http://www.w3.org/TR/REC-html40/interact/forms.html#edef-OPTION">OPTION in <abbr class=initialism title="World Wide Web Consortium">W3C</abbr> HTMLá4.0 Recommendation</a></li>
  82.   <li><a href="http://www.w3.org/TR/REC-html32#select">OPTION in <abbr class=initialism title="World Wide Web Consortium">W3C</abbr> HTMLá3.2 Recommendation</a></li>
  83.   <li><a href="http://www.w3.org/MarkUp/html-spec/html-spec_8.html#SEC8.1.3.1">OPTION in HTMLá2.0 Standard</a></li>
  84.   <li><a href="http://www.htmlhelp.com/reference/wilbur/form/option.html">OPTION in <abbr class=initialism title="Web Design Group">WDG</abbr> HTMLá3.2 Reference</a></li>
  85.   <li><a href="http://www.hut.fi/u/jkorpela/HTML3.2/5.41.html">OPTION in <cite>Learning HTMLá3.2 by Examples</cite></a></li>
  86. </ul>
  87. <div class=footer>
  88. <address>Maintained by <a href="http://www.htmlhelp.com/%7Eliam/">Liam Quinn</a> <<a href="mailto:liam@htmlhelp.com">liam@htmlhelp.com</a>></address>
  89. <p class=toolbar><a href="http://www.htmlhelp.com/"><img src="../wdglogo-small.gif" width=105 height=40 alt="Web Design Group ~"></a> <a href="../index.html" rel=Start>HTMLá4.0áReference</a>á~ <a href="../olist.html">ElementsábyáFunction</a>á~ <a href="../alist.html">ElementsáAlphabetically</a></p>
  90. <p class=copyright><a href="http://www.htmlhelp.com/copyright.html">Copyright ⌐</a> 1998 Liam Quinn. All rights reserved.</p>
  91. </div>
  92. </body>
  93. </html>
  94.