Annotation of html5/spec-author-view/the-button-element.html, revision 1.46
1.1 mike 1: <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
1.41 mike 2: <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
1.46 ! mike 3: <!-- when publishing, change bits marked ZZZ --><html lang="en-US-x-Hixie" class="split chapter"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>4.10.8 The button element — HTML5 (Edition for Web Authors)</title><script src="link-fixup.js"></script><link href="whatwg.css" rel="stylesheet"/><link href="style.css" rel="stylesheet"/><style type="text/css">
1.1 mike 4: pre { margin-left: 2em; white-space: pre-wrap; }
5: h2 { margin: 3em 0 1em 0; }
6: h3 { margin: 2.5em 0 1em 0; }
7: h4 { margin: 2.5em 0 0.75em 0; }
8: h5, h6 { margin: 2.5em 0 1em; }
9: h1 + h2, h1 + h2 + h2 { margin: 0.75em 0 0.75em; }
10: h2 + h3, h3 + h4, h4 + h5, h5 + h6 { margin-top: 0.5em; }
11: p { margin: 1em 0; }
12: hr:not(.top) { display: block; background: none; border: none; padding: 0; margin: 2em 0; height: auto; }
13: dl, dd { margin-top: 0; margin-bottom: 0; }
14: dt { margin-top: 0.75em; margin-bottom: 0.25em; clear: left; }
15: dt + dt { margin-top: 0; }
16: dd dt { margin-top: 0.25em; margin-bottom: 0; }
17: dd p { margin-top: 0; }
18: dd dl + p { margin-top: 1em; }
19: dd table + p { margin-top: 1em; }
20: p + * > li, dd li { margin: 1em 0; }
21: dt, dfn { font-weight: bold; font-style: normal; }
22: dt dfn { font-style: italic; }
23: pre, code { font-size: inherit; font-family: monospace; font-variant: normal; }
24: pre strong { color: black; font: inherit; font-weight: bold; background: yellow; }
25: pre em { font-weight: bolder; font-style: normal; }
26: @media screen { code { color: orangered; } code :link, code :visited { color: inherit; } }
27: var sub { vertical-align: bottom; font-size: smaller; position: relative; top: 0.1em; }
28: table { border-collapse: collapse; border-style: hidden hidden none hidden; }
1.34 mike 29: table thead, table tbody { border-bottom: solid; }
1.1 mike 30: table tbody th:first-child { border-left: solid; }
31: table tbody th { text-align: left; }
32: table td, table th { border-left: solid; border-right: solid; border-bottom: solid thin; vertical-align: top; padding: 0.2em; }
33: blockquote { margin: 0 0 0 2em; border: 0; padding: 0; font-style: italic; }
34:
35: .bad, .bad *:not(.XXX) { color: gray; border-color: gray; background: transparent; }
36: .matrix, .matrix td { border: none; text-align: right; }
37: .matrix { margin-left: 2em; }
38: .dice-example { border-collapse: collapse; border-style: hidden solid solid hidden; border-width: thin; margin-left: 3em; }
39: .dice-example caption { width: 30em; font-size: smaller; font-style: italic; padding: 0.75em 0; text-align: left; }
40: .dice-example td, .dice-example th { border: solid thin; width: 1.35em; height: 1.05em; text-align: center; padding: 0; }
41:
42: .toc dfn, h1 dfn, h2 dfn, h3 dfn, h4 dfn, h5 dfn, h6 dfn { font: inherit; }
43: img.extra { float: right; }
44: pre.idl { border: solid thin; background: #EEEEEE; color: black; padding: 0.5em 1em; }
45: pre.idl :link, pre.idl :visited { color: inherit; background: transparent; }
46: pre.css { border: solid thin; background: #FFFFEE; color: black; padding: 0.5em 1em; }
47: pre.css:first-line { color: #AAAA50; }
1.23 mike 48: dl.domintro { color: green; margin: 2em 0 2em 2em; padding: 0.5em 1em; border: none; background: #DDFFDD; }
1.1 mike 49: hr + dl.domintro, div.impl + dl.domintro { margin-top: 2.5em; margin-bottom: 1.5em; }
50: dl.domintro dt, dl.domintro dt * { color: black; text-decoration: none; }
51: dl.domintro dd { margin: 0.5em 0 1em 2em; padding: 0; }
52: dl.domintro dd p { margin: 0.5em 0; }
53: dl.switch { padding-left: 2em; }
54: dl.switch > dt { text-indent: -1.5em; }
55: dl.switch > dt:before { content: '\21AA'; padding: 0 0.5em 0 0; display: inline-block; width: 1em; text-align: right; line-height: 0.5em; }
56: dl.triple { padding: 0 0 0 1em; }
57: dl.triple dt, dl.triple dd { margin: 0; display: inline }
58: dl.triple dt:after { content: ':'; }
59: dl.triple dd:after { content: '\A'; white-space: pre; }
60: .diff-old { text-decoration: line-through; color: silver; background: transparent; }
61: .diff-chg, .diff-new { text-decoration: underline; color: green; background: transparent; }
62: a .diff-new { border-bottom: 1px blue solid; }
63:
64: h2 { page-break-before: always; }
65: h1, h2, h3, h4, h5, h6 { page-break-after: avoid; }
66: h1 + h2, hr + h2.no-toc { page-break-before: auto; }
67:
68: p > span:not([title=""]):not([class="XXX"]):not([class="impl"]), li > span:not([title=""]):not([class="XXX"]):not([class="impl"]) { border-bottom: solid #9999CC; }
69:
70: div.head { margin: 0 0 1em; padding: 1em 0 0 0; }
71: div.head p { margin: 0; }
72: div.head h1 { margin: 0; }
73: div.head .logo { float: right; margin: 0 1em; }
74: div.head .logo img { border: none } /* remove border from top image */
75: div.head dl { margin: 1em 0; }
76: div.head p.copyright, div.head p.alt { font-size: x-small; font-style: oblique; margin: 0; }
77:
78: body > .toc > li { margin-top: 1em; margin-bottom: 1em; }
79: body > .toc.brief > li { margin-top: 0.35em; margin-bottom: 0.35em; }
80: body > .toc > li > * { margin-bottom: 0.5em; }
81: body > .toc > li > * > li > * { margin-bottom: 0.25em; }
82: .toc, .toc li { list-style: none; }
83:
84: .brief { margin-top: 1em; margin-bottom: 1em; line-height: 1.1; }
85: .brief li { margin: 0; padding: 0; }
86: .brief li p { margin: 0; padding: 0; }
87:
88: .category-list { margin-top: -0.75em; margin-bottom: 1em; line-height: 1.5; }
89: .category-list::before { content: '\21D2\A0'; font-size: 1.2em; font-weight: 900; }
90: .category-list li { display: inline; }
91: .category-list li:not(:last-child)::after { content: ', '; }
92: .category-list li > span, .category-list li > a { text-transform: lowercase; }
93: .category-list li * { text-transform: none; } /* don't affect <code> nested in <a> */
94:
95: .XXX { color: #E50000; background: white; border: solid red; padding: 0.5em; margin: 1em 0; }
96: .XXX > :first-child { margin-top: 0; }
97: p .XXX { line-height: 3em; }
98: .annotation { border: solid thin black; background: #0C479D; color: white; position: relative; margin: 8px 0 20px 0; }
99: .annotation:before { position: absolute; left: 0; top: 0; width: 100%; height: 100%; margin: 6px -6px -6px 6px; background: #333333; z-index: -1; content: ''; }
100: .annotation :link, .annotation :visited { color: inherit; }
101: .annotation :link:hover, .annotation :visited:hover { background: transparent; }
102: .annotation span { border: none ! important; }
103: .note { color: green; background: transparent; font-family: sans-serif; }
104: .warning { color: red; background: transparent; }
105: .note, .warning { font-weight: bolder; font-style: italic; }
106: p.note, div.note { padding: 0.5em 2em; }
107: span.note { padding: 0 2em; }
108: .note p:first-child, .warning p:first-child { margin-top: 0; }
109: .note p:last-child, .warning p:last-child { margin-bottom: 0; }
110: .warning:before { font-style: normal; }
111: p.note:before { content: 'Note: '; }
112: p.warning:before { content: '\26A0 Warning! '; }
113:
114: .bookkeeping:before { display: block; content: 'Bookkeeping details'; font-weight: bolder; font-style: italic; }
115: .bookkeeping { font-size: 0.8em; margin: 2em 0; }
116: .bookkeeping p { margin: 0.5em 2em; display: list-item; list-style: square; }
117:
118: h4 { position: relative; z-index: 3; }
119: h4 + .element, h4 + div + .element { margin-top: -2.5em; padding-top: 2em; }
120: .element {
121: background: #EEEEFF;
122: color: black;
123: margin: 0 0 1em 0.15em;
124: padding: 0 1em 0.25em 0.75em;
125: border-left: solid #9999FF 0.25em;
126: position: relative;
127: z-index: 1;
128: }
129: .element:before {
130: position: absolute;
131: z-index: 2;
132: top: 0;
133: left: -1.15em;
134: height: 2em;
135: width: 0.9em;
136: background: #EEEEFF;
137: content: ' ';
138: border-style: none none solid solid;
139: border-color: #9999FF;
140: border-width: 0.25em;
141: }
142:
143: .example { display: block; color: #222222; background: #FCFCFC; border-left: double; margin-left: 2em; padding-left: 1em; }
144: td > .example:only-child { margin: 0 0 0 0.1em; }
145:
146: ul.domTree, ul.domTree ul { padding: 0 0 0 1em; margin: 0; }
147: ul.domTree li { padding: 0; margin: 0; list-style: none; position: relative; }
148: ul.domTree li li { list-style: none; }
149: ul.domTree li:first-child::before { position: absolute; top: 0; height: 0.6em; left: -0.75em; width: 0.5em; border-style: none none solid solid; content: ''; border-width: 0.1em; }
150: ul.domTree li:not(:last-child)::after { position: absolute; top: 0; bottom: -0.6em; left: -0.75em; width: 0.5em; border-style: none none solid solid; content: ''; border-width: 0.1em; }
151: ul.domTree span { font-style: italic; font-family: serif; }
152: ul.domTree .t1 code { color: purple; font-weight: bold; }
153: ul.domTree .t2 { font-style: normal; font-family: monospace; }
154: ul.domTree .t2 .name { color: black; font-weight: bold; }
155: ul.domTree .t2 .value { color: blue; font-weight: normal; }
156: ul.domTree .t3 code, .domTree .t4 code, .domTree .t5 code { color: gray; }
157: ul.domTree .t7 code, .domTree .t8 code { color: green; }
158: ul.domTree .t10 code { color: teal; }
159:
1.14 mike 160: body.dfnEnabled dfn { cursor: pointer; }
161: .dfnPanel {
162: display: inline;
163: position: absolute;
164: z-index: 10;
165: height: auto;
166: width: auto;
167: padding: 0.5em 0.75em;
168: font: small sans-serif, Droid Sans Fallback;
169: background: #DDDDDD;
170: color: black;
171: border: outset 0.2em;
172: }
173: .dfnPanel * { margin: 0; padding: 0; font: inherit; text-indent: 0; }
174: .dfnPanel :link, .dfnPanel :visited { color: black; }
175: .dfnPanel p { font-weight: bolder; }
176: .dfnPanel * + p { margin-top: 0.25em; }
177: .dfnPanel li { list-style-position: inside; }
178:
1.1 mike 179: #configUI { position: absolute; z-index: 20; top: 10em; right: 1em; width: 11em; font-size: small; }
180: #configUI p { margin: 0.5em 0; padding: 0.3em; background: #EEEEEE; color: black; border: inset thin; }
181: #configUI p label { display: block; }
182: #configUI #updateUI, #configUI .loginUI { text-align: center; }
183: #configUI input[type=button] { display: block; margin: auto; }
184: </style><style type="text/css">
185:
186: .applies thead th > * { display: block; }
187: .applies thead code { display: block; }
188: .applies tbody th { whitespace: nowrap; }
189: .applies td { text-align: center; }
190: .applies .yes { background: yellow; }
191:
192: .matrix, .matrix td { border: none; text-align: right; }
193: .matrix { margin-left: 2em; }
194:
195: .dice-example { border-collapse: collapse; border-style: hidden solid solid hidden; border-width: thin; margin-left: 3em; }
196: .dice-example caption { width: 30em; font-size: smaller; font-style: italic; padding: 0.75em 0; text-align: left; }
197: .dice-example td, .dice-example th { border: solid thin; width: 1.35em; height: 1.05em; text-align: center; padding: 0; }
198:
199: #table-example-1 { border: solid thin; border-collapse: collapse; margin-left: 3em; }
200: #table-example-1 * { font-family: "Essays1743", serif; line-height: 1.01em; }
201: #table-example-1 caption { padding-bottom: 0.5em; }
202: #table-example-1 thead, #table-example-1 tbody { border: none; }
203: #table-example-1 th, #table-example-1 td { border: solid thin; }
204: #table-example-1 th { font-weight: normal; }
205: #table-example-1 td { border-style: none solid; vertical-align: top; }
206: #table-example-1 th { padding: 0.5em; vertical-align: middle; text-align: center; }
207: #table-example-1 tbody tr:first-child td { padding-top: 0.5em; }
208: #table-example-1 tbody tr:last-child td { padding-bottom: 1.5em; }
209: #table-example-1 tbody td:first-child { padding-left: 2.5em; padding-right: 0; width: 9em; }
210: #table-example-1 tbody td:first-child::after { content: leader(". "); }
211: #table-example-1 tbody td { padding-left: 2em; padding-right: 2em; }
212: #table-example-1 tbody td:first-child + td { width: 10em; }
213: #table-example-1 tbody td:first-child + td ~ td { width: 2.5em; }
214: #table-example-1 tbody td:first-child + td + td + td ~ td { width: 1.25em; }
215:
216: .apple-table-examples { border: none; border-collapse: separate; border-spacing: 1.5em 0em; width: 40em; margin-left: 3em; }
217: .apple-table-examples * { font-family: "Times", serif; }
218: .apple-table-examples td, .apple-table-examples th { border: none; white-space: nowrap; padding-top: 0; padding-bottom: 0; }
219: .apple-table-examples tbody th:first-child { border-left: none; width: 100%; }
220: .apple-table-examples thead th:first-child ~ th { font-size: smaller; font-weight: bolder; border-bottom: solid 2px; text-align: center; }
221: .apple-table-examples tbody th::after, .apple-table-examples tfoot th::after { content: leader(". ") }
222: .apple-table-examples tbody th, .apple-table-examples tfoot th { font: inherit; text-align: left; }
223: .apple-table-examples td { text-align: right; vertical-align: top; }
224: .apple-table-examples.e1 tbody tr:last-child td { border-bottom: solid 1px; }
1.9 mike 225: .apple-table-examples.e1 tbody + tbody tr:last-child td { border-bottom: double 3px; }
226: .apple-table-examples.e2 th[scope=row] { padding-left: 1em; }
227: .apple-table-examples sup { line-height: 0; }
228:
1.11 mike 229: .details-example img { vertical-align: top; }
230:
1.26 mike 231: #named-character-references-table {
232: font-size: 0.6em;
233: column-width: 28em;
234: column-gap: 1em;
235: -moz-column-width: 28em;
236: -moz-column-gap: 1em;
237: -webkit-column-width: 28em;
238: -webkit-column-gap: 1em;
239: }
240: #named-character-references-table > table > tbody > tr > td:last-child { text-align: center; }
241: #named-character-references-table > table > tbody > tr > td:last-child:hover > span { position: absolute; top: auto; left: auto; margin-left: 0.5em; line-height: 1.2; font-size: 5em; border: outset; padding: 0.25em 0.5em; background: white; width: 1.25em; height: auto; text-align: center; }
242:
1.35 mike 243: .glyph.control { color: red; }
244:
1.38 mike 245: @font-face {
246: font-family: 'Essays1743';
247: src: url('http://www.whatwg.org/specs/web-apps/current-work/fonts/Essays1743.ttf');
248: }
249: @font-face {
250: font-family: 'Essays1743';
251: font-weight: bold;
252: src: url('http://www.whatwg.org/specs/web-apps/current-work/fonts/Essays1743-Bold.ttf');
253: }
254: @font-face {
255: font-family: 'Essays1743';
256: font-style: italic;
257: src: url('http://www.whatwg.org/specs/web-apps/current-work/fonts/Essays1743-Italic.ttf');
258: }
259: @font-face {
260: font-family: 'Essays1743';
261: font-style: italic;
262: font-weight: bold;
263: src: url('http://www.whatwg.org/specs/web-apps/current-work/fonts/Essays1743-BoldItalic.ttf');
264: }
265:
1.24 mike 266: </style><style type="text/css">
1.44 mike 267:
1.25 mike 268: </style><link href="data:text/css," id="complete" rel="stylesheet" title="Complete specification"><link href="data:text/css,.impl%20%7B%20display:%20none;%20%7D%0Ahtml%20%7B%20border:%20solid%20yellow;%20%7D%20.domintro:before%20%7B%20display:%20none;%20%7D" id="author" rel="alternate stylesheet" title="Author documentation only"><link href="data:text/css,.impl%20%7B%20background:%20%23FFEEEE;%20%7D%20.domintro:before%20%7B%20background:%20%23FFEEEE;%20%7D" id="highlight" rel="alternate stylesheet" title="Highlight implementation requirements"><script type="text/javascript">
1.9 mike 269: function getCookie(name) {
270: var params = location.search.substr(1).split("&");
271: for (var index = 0; index < params.length; index++) {
272: if (params[index] == name)
273: return "1";
274: var data = params[index].split("=");
275: if (data[0] == name)
276: return unescape(data[1]);
277: }
278: var cookies = document.cookie.split("; ");
279: for (var index = 0; index < cookies.length; index++) {
280: var data = cookies[index].split("=");
281: if (data[0] == name)
282: return unescape(data[1]);
283: }
284: return null;
285: }
286: function load(script) {
287: var e = document.createElement('script');
288: e.setAttribute('src', 'http://www.whatwg.org/specs/web-apps/current-work/' + script + '?' + encodeURIComponent(location) + '&' + encodeURIComponent(document.referrer));
289: document.body.appendChild(e);
290: }
291: function init() {
292: if (location.search == '?slow-browser')
293: return;
294: var configUI = document.createElement('div');
295: configUI.id = 'configUI';
296: document.body.appendChild(configUI);
297: // load('reviewer.js'); // would need cross-site XHR
298: if (document.getElementById('head'))
299: load('toc.js');
300:
301: // load('updater.js'); // would need cross-site XHR
1.11 mike 302: load('dfn.js'); // doesn't support split-out specs, but, oh well.
1.9 mike 303: // load('status.js'); // would need cross-site XHR
304: if (getCookie('profile') == '1')
305: document.getElementsByTagName('h2')[0].textContent += '; load: ' + (new Date() - loadTimer) + 'ms';
306: fixBrokenLink();
307: }
1.46 ! mike 308: </script><link href="http://www.w3.org/StyleSheets/TR/W3C-WD" rel="stylesheet" type="text/css"><link href="style.css" rel="stylesheet"><link href="common-input-element-attributes.html" title="4.10.7.2 Common input element attributes" rel="prev">
1.9 mike 309: <link href="Overview.html#contents" title="Table of contents" rel="index">
1.20 mike 310: <link href="association-of-controls-and-forms.html" title="4.10.18 Association of controls and forms" rel="next">
1.9 mike 311: </head><body onload="fixBrokenLink(); init()"><div class="head" id="head">
312: <p><a href="http://www.w3.org/"><img alt="W3C" height="48" src="http://www.w3.org/Icons/w3c_home" width="72"></a></p>
1.36 mike 313:
1.46 ! mike 314: <h1>HTML5 (Edition for Web Authors)<span class="rcsrevision"> revision 1.4104</span></h1>
1.9 mike 315: </div><div>
1.20 mike 316: <a href="common-input-element-attributes.html">← 4.10.7.2 Common input element attributes</a> –
1.9 mike 317: <a href="Overview.html#contents">Table of contents</a> –
1.20 mike 318: <a href="association-of-controls-and-forms.html">4.10.18 Association of controls and forms →</a>
319: <ol class="toc"><li><ol><li><ol><li><a href="the-button-element.html#the-button-element"><span class="secno">4.10.8 </span>The <code>button</code> element</a></li><li><a href="the-button-element.html#the-select-element"><span class="secno">4.10.9 </span>The <code>select</code> element</a></li><li><a href="the-button-element.html#the-datalist-element"><span class="secno">4.10.10 </span>The <code>datalist</code> element</a></li><li><a href="the-button-element.html#the-optgroup-element"><span class="secno">4.10.11 </span>The <code>optgroup</code> element</a></li><li><a href="the-button-element.html#the-option-element"><span class="secno">4.10.12 </span>The <code>option</code> element</a></li><li><a href="the-button-element.html#the-textarea-element"><span class="secno">4.10.13 </span>The <code>textarea</code> element</a></li><li><a href="the-button-element.html#the-keygen-element"><span class="secno">4.10.14 </span>The <code>keygen</code> element</a></li><li><a href="the-button-element.html#the-output-element"><span class="secno">4.10.15 </span>The <code>output</code> element</a></li><li><a href="the-button-element.html#the-progress-element"><span class="secno">4.10.16 </span>The <code>progress</code> element</a></li><li><a href="the-button-element.html#the-meter-element"><span class="secno">4.10.17 </span>The <code>meter</code> element</a></li></ol></li></ol></li></ol></div>
1.9 mike 320:
1.30 mike 321: <h4 id="the-button-element"><span class="secno">4.10.8 </span>The <dfn><code>button</code></dfn> element</h4><p class="XXX annotation"><b>Status: </b><i>Last call for comments</i></p><dl class="element"><dt>Categories</dt>
1.9 mike 322: <dd><a href="content-models.html#flow-content">Flow content</a>.</dd>
323: <dd><a href="content-models.html#phrasing-content">Phrasing content</a>.</dd>
324: <dd><a href="content-models.html#interactive-content">Interactive content</a>.</dd>
325: <dd><a href="forms.html#category-listed" title="category-listed">Listed</a>, <a href="forms.html#category-label" title="category-label">labelable</a>, and <a href="forms.html#category-submit" title="category-submit">submittable</a> <a href="forms.html#form-associated-element">form-associated element</a>.</dd>
326: <dt>Contexts in which this element may be used:</dt>
327: <dd>Where <a href="content-models.html#phrasing-content">phrasing content</a> is expected.</dd>
328: <dt>Content model:</dt>
329: <dd><a href="content-models.html#phrasing-content">Phrasing content</a>, but there must be no <a href="content-models.html#interactive-content">interactive content</a> descendant.</dd>
330: <dt>Content attributes:</dt>
331: <dd><a href="elements.html#global-attributes">Global attributes</a></dd>
332: <dd><code title="attr-fe-autofocus"><a href="association-of-controls-and-forms.html#attr-fe-autofocus">autofocus</a></code></dd>
333: <dd><code title="attr-fe-disabled"><a href="association-of-controls-and-forms.html#attr-fe-disabled">disabled</a></code></dd>
334: <dd><code title="attr-fae-form"><a href="association-of-controls-and-forms.html#attr-fae-form">form</a></code></dd>
335: <dd><code title="attr-fs-formaction"><a href="association-of-controls-and-forms.html#attr-fs-formaction">formaction</a></code></dd>
336: <dd><code title="attr-fs-formenctype"><a href="association-of-controls-and-forms.html#attr-fs-formenctype">formenctype</a></code></dd>
337: <dd><code title="attr-fs-formmethod"><a href="association-of-controls-and-forms.html#attr-fs-formmethod">formmethod</a></code></dd>
338: <dd><code title="attr-fs-formnovalidate"><a href="association-of-controls-and-forms.html#attr-fs-formnovalidate">formnovalidate</a></code></dd>
339: <dd><code title="attr-fs-formtarget"><a href="association-of-controls-and-forms.html#attr-fs-formtarget">formtarget</a></code></dd>
340: <dd><code title="attr-fe-name"><a href="association-of-controls-and-forms.html#attr-fe-name">name</a></code></dd>
341: <dd><code title="attr-button-type"><a href="#attr-button-type">type</a></code></dd>
342: <dd><code title="attr-button-value"><a href="#attr-button-value">value</a></code></dd>
343: <dt>DOM interface:</dt>
344: <dd>
345: <pre class="idl">interface <dfn id="htmlbuttonelement">HTMLButtonElement</dfn> : <a href="elements.html#htmlelement">HTMLElement</a> {
1.42 mike 346: attribute boolean <a href="http://dev.w3.org/html5/spec/association-of-controls-and-forms.html#dom-fe-autofocus" title='Read about this "autofocus" reference in the full HTML5 spec.' class="full-spec-link">autofocus</a>;
347: attribute boolean <a href="http://dev.w3.org/html5/spec/association-of-controls-and-forms.html#dom-fe-disabled" title='Read about this "disabled" reference in the full HTML5 spec.' class="full-spec-link">disabled</a>;
348: readonly attribute <a href="forms.html#htmlformelement">HTMLFormElement</a> <a href="http://dev.w3.org/html5/spec/association-of-controls-and-forms.html#dom-fae-form" title='Read about this "form" reference in the full HTML5 spec.' class="full-spec-link">form</a>;
349: attribute DOMString <a href="http://dev.w3.org/html5/spec/association-of-controls-and-forms.html#dom-fs-formaction" title='Read about this "formAction" reference in the full HTML5 spec.' class="full-spec-link">formAction</a>;
350: attribute DOMString <a href="http://dev.w3.org/html5/spec/association-of-controls-and-forms.html#dom-fs-formenctype" title='Read about this "formEnctype" reference in the full HTML5 spec.' class="full-spec-link">formEnctype</a>;
351: attribute DOMString <a href="http://dev.w3.org/html5/spec/association-of-controls-and-forms.html#dom-fs-formmethod" title='Read about this "formMethod" reference in the full HTML5 spec.' class="full-spec-link">formMethod</a>;
352: attribute DOMString <a href="http://dev.w3.org/html5/spec/association-of-controls-and-forms.html#dom-fs-formnovalidate" title='Read about this "formNoValidate" reference in the full HTML5 spec.' class="full-spec-link">formNoValidate</a>;
353: attribute DOMString <a href="http://dev.w3.org/html5/spec/association-of-controls-and-forms.html#dom-fs-formtarget" title='Read about this "formTarget" reference in the full HTML5 spec.' class="full-spec-link">formTarget</a>;
354: attribute DOMString <a href="http://dev.w3.org/html5/spec/association-of-controls-and-forms.html#dom-fe-name" title='Read about this "name" reference in the full HTML5 spec.' class="full-spec-link">name</a>;
355: attribute DOMString <a href="http://dev.w3.org/html5/spec/the-button-element.html#dom-button-type" title='Read about this "type" reference in the full HTML5 spec.' class="full-spec-link">type</a>;
356: attribute DOMString <a href="http://dev.w3.org/html5/spec/the-button-element.html#dom-button-value" title='Read about this "value" reference in the full HTML5 spec.' class="full-spec-link">value</a>;
357:
358: readonly attribute boolean <a href="http://dev.w3.org/html5/spec/association-of-controls-and-forms.html#dom-cva-willvalidate" title='Read about this "willValidate" reference in the full HTML5 spec.' class="full-spec-link">willValidate</a>;
359: readonly attribute <a href="http://dev.w3.org/html5/spec/association-of-controls-and-forms.html#validitystate" class="full-spec-link" title='Read about this "ValidityState" reference in the full HTML5 spec.'>ValidityState</a> <a href="http://dev.w3.org/html5/spec/association-of-controls-and-forms.html#dom-cva-validity" title='Read about this "validity" reference in the full HTML5 spec.' class="full-spec-link">validity</a>;
360: readonly attribute DOMString <a href="http://dev.w3.org/html5/spec/association-of-controls-and-forms.html#dom-cva-validationmessage" title='Read about this "validationMessage" reference in the full HTML5 spec.' class="full-spec-link">validationMessage</a>;
361: boolean <a href="http://dev.w3.org/html5/spec/association-of-controls-and-forms.html#dom-cva-checkvalidatity" title='Read about this "checkValidity" reference in the full HTML5 spec.' class="full-spec-link">checkValidity</a>();
362: void <a href="http://dev.w3.org/html5/spec/association-of-controls-and-forms.html#dom-cva-setcustomvalidity" title='Read about this "setCustomValidity" reference in the full HTML5 spec.' class="full-spec-link">setCustomValidity</a>(in DOMString error);
1.9 mike 363:
1.42 mike 364: readonly attribute <a href="http://dev.w3.org/html5/spec/infrastructure.html#nodelist" class="full-spec-link" title='Read about this "NodeList" reference in the full HTML5 spec.'>NodeList</a> <a href="http://dev.w3.org/html5/spec/forms.html#dom-lfe-labels" title='Read about this "labels" reference in the full HTML5 spec.' class="full-spec-link">labels</a>;
1.9 mike 365: };</pre>
366: </dd>
1.42 mike 367: </dl><p>The <code><a href="#the-button-element">button</a></code> element <a href="http://dev.w3.org/html5/spec/rendering.html#represents" class="full-spec-link" title='Read about this "represents" reference in the full HTML5 spec.'>represents</a> a
1.9 mike 368: button. </p><p>The element is a <a href="forms.html#concept-button" title="concept-button">button</a>.</p><p>The <dfn id="attr-button-type" title="attr-button-type"><code>type</code></dfn>
369: attribute controls the behavior of the button when it is activated.
370: It is an <a href="common-microsyntaxes.html#enumerated-attribute">enumerated attribute</a>. The following table
1.41 mike 371: lists the keywords and states for the attribute — the keywords
1.9 mike 372: in the left column map to the states in the cell in the second
373: column on the same row as the keyword.</p><table><thead><tr><th> Keyword
374: </th><th> State
375: </th><th> Brief description
376: </th></tr></thead><tbody><tr><td><dfn id="attr-button-type-submit" title="attr-button-type-submit"><code>submit</code></dfn>
1.42 mike 377: </td><td><a href="http://dev.w3.org/html5/spec/the-button-element.html#attr-button-type-submit-state" title='Read about this "Submit Button" reference in the full HTML5 spec.' class="full-spec-link">Submit Button</a>
1.9 mike 378: </td><td>Submits the form.
379: </td></tr><tr><td><dfn id="attr-button-type-reset" title="attr-button-type-reset"><code>reset</code></dfn>
1.42 mike 380: </td><td><a href="http://dev.w3.org/html5/spec/the-button-element.html#attr-button-type-reset-state" title='Read about this "Reset Button" reference in the full HTML5 spec.' class="full-spec-link">Reset Button</a>
1.9 mike 381: </td><td>Resets the form.
382: </td></tr><tr><td><dfn id="attr-button-type-button" title="attr-button-type-button"><code>button</code></dfn>
1.42 mike 383: </td><td><a href="http://dev.w3.org/html5/spec/the-button-element.html#attr-button-type-button-state" title='Read about this "Button" reference in the full HTML5 spec.' class="full-spec-link">Button</a>
1.9 mike 384: </td><td>Does nothing.
1.42 mike 385: </td></tr></tbody></table><p>The <i>missing value default</i> is the <a href="http://dev.w3.org/html5/spec/the-button-element.html#attr-button-type-submit-state" title='Read about this "Submit Button" reference in the full HTML5 spec.' class="full-spec-link">Submit Button</a>
1.9 mike 386: state.</p><p>If the <code title="attr-button-type"><a href="#attr-button-type">type</a></code> attribute is in
1.42 mike 387: the <a href="http://dev.w3.org/html5/spec/the-button-element.html#attr-button-type-submit-state" title='Read about this "Submit Button" reference in the full HTML5 spec.' class="full-spec-link">Submit Button</a>
1.9 mike 388: state, the element is specifically a <a href="forms.html#concept-submit-button" title="concept-submit-button">submit button</a>.</p><p>The <code title="attr-fae-form"><a href="association-of-controls-and-forms.html#attr-fae-form">form</a></code> attribute is used to
389: explicitly associate the <code><a href="#the-button-element">button</a></code> element with its
390: <a href="association-of-controls-and-forms.html#form-owner">form owner</a>. The <code title="attr-fe-name"><a href="association-of-controls-and-forms.html#attr-fe-name">name</a></code>
391: attribute represents the element's name. The <code title="attr-fe-disabled"><a href="association-of-controls-and-forms.html#attr-fe-disabled">disabled</a></code> attribute is used to make
392: the control non-interactive and to prevent its value from being
393: submitted. The <code title="attr-fe-autofocus"><a href="association-of-controls-and-forms.html#attr-fe-autofocus">autofocus</a></code>
394: attribute controls focus. The <code title="attr-fs-formaction"><a href="association-of-controls-and-forms.html#attr-fs-formaction">formaction</a></code>, <code title="attr-fs-formenctype"><a href="association-of-controls-and-forms.html#attr-fs-formenctype">formenctype</a></code>, <code title="attr-fs-formmethod"><a href="association-of-controls-and-forms.html#attr-fs-formmethod">formmethod</a></code>, <code title="attr-fs-formnovalidate"><a href="association-of-controls-and-forms.html#attr-fs-formnovalidate">formnovalidate</a></code>, and <code title="attr-fs-formtarget"><a href="association-of-controls-and-forms.html#attr-fs-formtarget">formtarget</a></code> attributes are
395: <a href="association-of-controls-and-forms.html#attributes-for-form-submission">attributes for form submission</a>.</p><p class="note">The <code title="attr-fs-formnovalidate"><a href="association-of-controls-and-forms.html#attr-fs-formnovalidate">formnovalidate</a></code> attribute can
396: be used to make submit buttons that do not trigger the constraint
1.15 mike 397: validation.</p><p>The <code title="attr-fs-formaction"><a href="association-of-controls-and-forms.html#attr-fs-formaction">formaction</a></code>, <code title="attr-fs-formenctype"><a href="association-of-controls-and-forms.html#attr-fs-formenctype">formenctype</a></code>, <code title="attr-fs-formmethod"><a href="association-of-controls-and-forms.html#attr-fs-formmethod">formmethod</a></code>, <code title="attr-fs-formnovalidate"><a href="association-of-controls-and-forms.html#attr-fs-formnovalidate">formnovalidate</a></code>, and <code title="attr-fs-formtarget"><a href="association-of-controls-and-forms.html#attr-fs-formtarget">formtarget</a></code> must not be specified
398: if the element's <code title="attr-button-type"><a href="#attr-button-type">type</a></code>
1.42 mike 399: attribute is not in the <a href="http://dev.w3.org/html5/spec/the-button-element.html#attr-button-type-submit-state" title='Read about this "Submit Button" reference in the full HTML5 spec.' class="full-spec-link">Submit Button</a>
1.15 mike 400: state.</p><p>The <dfn id="attr-button-value" title="attr-button-value"><code>value</code></dfn>
1.9 mike 401: attribute gives the element's value for the purposes of form
1.42 mike 402: submission. The element's <a href="http://dev.w3.org/html5/spec/association-of-controls-and-forms.html#concept-fe-value" title='Read about this "value" reference in the full HTML5 spec.' class="full-spec-link">value</a> is the value of the element's
1.10 mike 403: <code title="attr-button-value"><a href="#attr-button-value">value</a></code> attribute, if there is
404: one, or the empty string otherwise.</p><p class="note">A button (and its value) is only included in the
1.9 mike 405: form submission if the button itself was used to initiate the form
406: submission.</p><div class="example">
407:
408: <p>The following button is labeled "Show hint" and pops up a dialog
409: box when activated:</p>
410:
411: <pre><button type=button
412: onclick="alert('This 15-20 minute piece was composed by George Gershwin.')">
413: Show hint
414: </button></pre>
415:
1.30 mike 416: </div><h4 id="the-select-element"><span class="secno">4.10.9 </span>The <dfn><code>select</code></dfn> element</h4><p class="XXX annotation"><b>Status: </b><i>Last call for comments</i></p><dl class="element"><dt>Categories</dt>
1.9 mike 417: <dd><a href="content-models.html#flow-content">Flow content</a>.</dd>
418: <dd><a href="content-models.html#phrasing-content">Phrasing content</a>.</dd>
419: <dd><a href="content-models.html#interactive-content">Interactive content</a>.</dd>
420: <dd><a href="forms.html#category-listed" title="category-listed">Listed</a>, <a href="forms.html#category-label" title="category-label">labelable</a>, <a href="forms.html#category-submit" title="category-submit">submittable</a>, and <a href="forms.html#category-reset" title="category-reset">resettable</a> <a href="forms.html#form-associated-element">form-associated element</a>.</dd>
421: <dt>Contexts in which this element may be used:</dt>
422: <dd>Where <a href="content-models.html#phrasing-content">phrasing content</a> is expected.</dd>
423: <dt>Content model:</dt>
424: <dd>Zero or more <code><a href="#the-option-element">option</a></code> or <code><a href="#the-optgroup-element">optgroup</a></code> elements.</dd>
425: <dt>Content attributes:</dt>
426: <dd><a href="elements.html#global-attributes">Global attributes</a></dd>
427: <dd><code title="attr-fe-autofocus"><a href="association-of-controls-and-forms.html#attr-fe-autofocus">autofocus</a></code></dd>
428: <dd><code title="attr-fe-disabled"><a href="association-of-controls-and-forms.html#attr-fe-disabled">disabled</a></code></dd>
429: <dd><code title="attr-fae-form"><a href="association-of-controls-and-forms.html#attr-fae-form">form</a></code></dd>
430: <dd><code title="attr-select-multiple"><a href="#attr-select-multiple">multiple</a></code></dd>
431: <dd><code title="attr-fe-name"><a href="association-of-controls-and-forms.html#attr-fe-name">name</a></code></dd>
432: <dd><code title="attr-select-size"><a href="#attr-select-size">size</a></code></dd>
433: <dt>DOM interface:</dt>
434: <dd>
435: <pre class="idl">interface <dfn id="htmlselectelement">HTMLSelectElement</dfn> : <a href="elements.html#htmlelement">HTMLElement</a> {
1.42 mike 436: attribute boolean <a href="http://dev.w3.org/html5/spec/association-of-controls-and-forms.html#dom-fe-autofocus" title='Read about this "autofocus" reference in the full HTML5 spec.' class="full-spec-link">autofocus</a>;
437: attribute boolean <a href="http://dev.w3.org/html5/spec/association-of-controls-and-forms.html#dom-fe-disabled" title='Read about this "disabled" reference in the full HTML5 spec.' class="full-spec-link">disabled</a>;
438: readonly attribute <a href="forms.html#htmlformelement">HTMLFormElement</a> <a href="http://dev.w3.org/html5/spec/association-of-controls-and-forms.html#dom-fae-form" title='Read about this "form" reference in the full HTML5 spec.' class="full-spec-link">form</a>;
439: attribute boolean <a href="http://dev.w3.org/html5/spec/the-button-element.html#dom-select-multiple" title='Read about this "multiple" reference in the full HTML5 spec.' class="full-spec-link">multiple</a>;
440: attribute DOMString <a href="http://dev.w3.org/html5/spec/association-of-controls-and-forms.html#dom-fe-name" title='Read about this "name" reference in the full HTML5 spec.' class="full-spec-link">name</a>;
441: attribute unsigned long <a href="http://dev.w3.org/html5/spec/the-button-element.html#dom-select-size" title='Read about this "size" reference in the full HTML5 spec.' class="full-spec-link">size</a>;
442:
443: readonly attribute DOMString <a href="http://dev.w3.org/html5/spec/the-button-element.html#dom-select-type" title='Read about this "type" reference in the full HTML5 spec.' class="full-spec-link">type</a>;
444:
445: readonly attribute <a href="urls.html#htmloptionscollection">HTMLOptionsCollection</a> <a href="http://dev.w3.org/html5/spec/the-button-element.html#dom-select-options" title='Read about this "options" reference in the full HTML5 spec.' class="full-spec-link">options</a>;
446: attribute unsigned long <a href="http://dev.w3.org/html5/spec/the-button-element.html#dom-select-length" title='Read about this "length" reference in the full HTML5 spec.' class="full-spec-link">length</a>;
447: caller getter any <a href="http://dev.w3.org/html5/spec/the-button-element.html#dom-select-item" title='Read about this "item" reference in the full HTML5 spec.' class="full-spec-link">item</a>(in unsigned long index);
448: caller getter any <a href="http://dev.w3.org/html5/spec/the-button-element.html#dom-select-nameditem" title='Read about this "namedItem" reference in the full HTML5 spec.' class="full-spec-link">namedItem</a>(in DOMString name);
449: void <a href="http://dev.w3.org/html5/spec/the-button-element.html#dom-select-add" title='Read about this "add" reference in the full HTML5 spec.' class="full-spec-link">add</a>(in <a href="elements.html#htmlelement">HTMLElement</a> element, in optional <a href="elements.html#htmlelement">HTMLElement</a> before);
450: void <a href="http://dev.w3.org/html5/spec/the-button-element.html#dom-select-add" title='Read about this "add" reference in the full HTML5 spec.' class="full-spec-link">add</a>(in <a href="elements.html#htmlelement">HTMLElement</a> element, in long before);
451: void <a href="http://dev.w3.org/html5/spec/the-button-element.html#dom-select-remove" title='Read about this "remove" reference in the full HTML5 spec.' class="full-spec-link">remove</a>(in long index);
452:
453: readonly attribute <a href="urls.html#htmlcollection">HTMLCollection</a> <a href="http://dev.w3.org/html5/spec/the-button-element.html#dom-select-selectedoptions" title='Read about this "selectedOptions" reference in the full HTML5 spec.' class="full-spec-link">selectedOptions</a>;
454: attribute long <a href="http://dev.w3.org/html5/spec/the-button-element.html#dom-select-selectedindex" title='Read about this "selectedIndex" reference in the full HTML5 spec.' class="full-spec-link">selectedIndex</a>;
455: attribute DOMString <a href="http://dev.w3.org/html5/spec/the-button-element.html#dom-select-value" title='Read about this "value" reference in the full HTML5 spec.' class="full-spec-link">value</a>;
456:
457: readonly attribute boolean <a href="http://dev.w3.org/html5/spec/association-of-controls-and-forms.html#dom-cva-willvalidate" title='Read about this "willValidate" reference in the full HTML5 spec.' class="full-spec-link">willValidate</a>;
458: readonly attribute <a href="http://dev.w3.org/html5/spec/association-of-controls-and-forms.html#validitystate" class="full-spec-link" title='Read about this "ValidityState" reference in the full HTML5 spec.'>ValidityState</a> <a href="http://dev.w3.org/html5/spec/association-of-controls-and-forms.html#dom-cva-validity" title='Read about this "validity" reference in the full HTML5 spec.' class="full-spec-link">validity</a>;
459: readonly attribute DOMString <a href="http://dev.w3.org/html5/spec/association-of-controls-and-forms.html#dom-cva-validationmessage" title='Read about this "validationMessage" reference in the full HTML5 spec.' class="full-spec-link">validationMessage</a>;
460: boolean <a href="http://dev.w3.org/html5/spec/association-of-controls-and-forms.html#dom-cva-checkvalidatity" title='Read about this "checkValidity" reference in the full HTML5 spec.' class="full-spec-link">checkValidity</a>();
461: void <a href="http://dev.w3.org/html5/spec/association-of-controls-and-forms.html#dom-cva-setcustomvalidity" title='Read about this "setCustomValidity" reference in the full HTML5 spec.' class="full-spec-link">setCustomValidity</a>(in DOMString error);
1.9 mike 462:
1.42 mike 463: readonly attribute <a href="http://dev.w3.org/html5/spec/infrastructure.html#nodelist" class="full-spec-link" title='Read about this "NodeList" reference in the full HTML5 spec.'>NodeList</a> <a href="http://dev.w3.org/html5/spec/forms.html#dom-lfe-labels" title='Read about this "labels" reference in the full HTML5 spec.' class="full-spec-link">labels</a>;
1.9 mike 464: };</pre>
465: </dd>
466: </dl><!-- Proposals for v2:
467: * <select value=""> as an alternative to <option selected>
468: http://developers.slashdot.org/comments.pl?sid=426306&cid=22142072
1.11 mike 469: <Philip`> http://www.ipiao.com.cn/ does <select size="1" name="to"><script type="text/javascript">City_Default="PEK"</script><SCRIPT language=javascript
1.9 mike 470: src="/js/flightcity.js"></SCRIPT></select> which is the kind of thing that could be much simpler with <select value="PEK">
471: * a way to make the <select> not have a default value at all (ack
472: or to have a "placeholer" like value that doesn't count as a value being selected but shows a prompt until a value is selected
473: * once we can have no default, a way to require="" a value.
474: ack Weston Ruter: http://weston.ruter.net/projects/test-cases/html-select-element/
475: q.v. http://lists.whatwg.org/pipermail/whatwg-whatwg.org/2008-November/017583.html
476: --><p>The <code><a href="#the-select-element">select</a></code> element represents a control for
477: selecting amongst a set of options.</p><p>The <dfn id="attr-select-multiple" title="attr-select-multiple"><code>multiple</code></dfn>
478: attribute is a <a href="common-microsyntaxes.html#boolean-attribute">boolean attribute</a>. If the attribute is
479: present, then the <code><a href="#the-select-element">select</a></code> element
1.42 mike 480: <a href="http://dev.w3.org/html5/spec/rendering.html#represents" class="full-spec-link" title='Read about this "represents" reference in the full HTML5 spec.'>represents</a> a control for selecting zero or more options
1.9 mike 481: from the <a href="#concept-select-option-list" title="concept-select-option-list">list of
482: options</a>. If the attribute is absent, then the
1.42 mike 483: <code><a href="#the-select-element">select</a></code> element <a href="http://dev.w3.org/html5/spec/rendering.html#represents" class="full-spec-link" title='Read about this "represents" reference in the full HTML5 spec.'>represents</a> a control for
1.9 mike 484: selecting a single option from the <a href="#concept-select-option-list" title="concept-select-option-list">list of options</a>.</p><p>The <dfn id="concept-select-option-list" title="concept-select-option-list">list of options</dfn>
485: for a <code><a href="#the-select-element">select</a></code> element consists of all the
486: <code><a href="#the-option-element">option</a></code> element children of the <code><a href="#the-select-element">select</a></code>
487: element, and all the <code><a href="#the-option-element">option</a></code> element children of all the
488: <code><a href="#the-optgroup-element">optgroup</a></code> element children of the <code><a href="#the-select-element">select</a></code>
489: element, in <a href="infrastructure.html#tree-order">tree order</a>.</p><p>The <dfn id="attr-select-size" title="attr-select-size"><code>size</code></dfn>
490: attribute gives the number of options to show to the user. The <code title="attr-input-size"><a href="common-input-element-attributes.html#attr-input-size">size</a></code> attribute, if specified, must
491: have a value that is a <a href="common-microsyntaxes.html#valid-non-negative-integer">valid non-negative integer</a>
492: greater than zero. If the <code title="attr-select-multiple"><a href="#attr-select-multiple">multiple</a></code> attribute is present,
493: then the <code title="attr-input-size"><a href="common-input-element-attributes.html#attr-input-size">size</a></code> attribute's
494: default value is 4. If the <code title="attr-select-multiple"><a href="#attr-select-multiple">multiple</a></code> attribute is absent,
495: then the <code title="attr-input-size"><a href="common-input-element-attributes.html#attr-input-size">size</a></code> attribute's
496: default value is 1.</p><p>The <code title="attr-fae-form"><a href="association-of-controls-and-forms.html#attr-fae-form">form</a></code> attribute is used to
497: explicitly associate the <code><a href="#the-select-element">select</a></code> element with its
498: <a href="association-of-controls-and-forms.html#form-owner">form owner</a>. The <code title="attr-fe-name"><a href="association-of-controls-and-forms.html#attr-fe-name">name</a></code>
499: attribute represents the element's name. The <code title="attr-fe-disabled"><a href="association-of-controls-and-forms.html#attr-fe-disabled">disabled</a></code> attribute is used to make
500: the control non-interactive and to prevent its value from being
501: submitted. The <code title="attr-fe-autofocus"><a href="association-of-controls-and-forms.html#attr-fe-autofocus">autofocus</a></code>
1.42 mike 502: attribute controls focus.</p><dl class="domintro"><dt><var title="">select</var> . <code title="dom-select-type"><a href="http://dev.w3.org/html5/spec/the-button-element.html#dom-select-type" class="full-spec-link" title='Read about this "type" reference in the full HTML5 spec.'>type</a></code></dt>
1.9 mike 503:
504: <dd>
505:
506: <p>Returns "<code title="">select-multiple</code>" if the element
507: has a <code title="attr-select-multiple"><a href="#attr-select-multiple">multiple</a></code>
508: attribute, and "<code title="">select-one</code>"
509: otherwise.</p>
510:
511: </dd>
512:
1.42 mike 513: <dt><var title="">select</var> . <code title="dom-select-options"><a href="http://dev.w3.org/html5/spec/the-button-element.html#dom-select-options" class="full-spec-link" title='Read about this "options" reference in the full HTML5 spec.'>options</a></code></dt>
1.9 mike 514:
515: <dd>
516:
517: <p>Returns an <code><a href="urls.html#htmloptionscollection">HTMLOptionsCollection</a></code> of the <a href="#concept-select-option-list" title="concept-select-option-list">list of options</a>.</p>
518:
519: </dd>
520:
1.42 mike 521: <dt><var title="">select</var> . <code title="dom-select-length"><a href="http://dev.w3.org/html5/spec/the-button-element.html#dom-select-length" class="full-spec-link" title='Read about this "length" reference in the full HTML5 spec.'>length</a></code> [ = <var title="">value</var> ]</dt>
1.9 mike 522: <dd>
523: <p>Returns the number of elements in the <a href="#concept-select-option-list" title="concept-select-option-list">list of options</a>.</p>
524: <p>When set to a smaller number, truncates the number of <code><a href="#the-option-element">option</a></code> elements in the <code><a href="#the-select-element">select</a></code>.</p>
525: <p>When set to a greater number, adds new blank <code><a href="#the-option-element">option</a></code> elements to the <code><a href="#the-select-element">select</a></code>.</p>
526: </dd>
527:
1.42 mike 528: <dt><var title="">element</var> = <var title="">select</var> . <code title="dom-select-item"><a href="http://dev.w3.org/html5/spec/the-button-element.html#dom-select-item" class="full-spec-link" title='Read about this "item" reference in the full HTML5 spec.'>item</a></code>(<var title="">index</var>)</dt>
1.9 mike 529: <dt><var title="">select</var>[<var title="">index</var>]</dt>
530: <dt><var title="">select</var>(<var title="">index</var>)</dt>
531: <dd>
532: <p>Returns the item with index <var title="">index</var> from the <a href="#concept-select-option-list" title="concept-select-option-list">list of options</a>. The items are sorted in <a href="infrastructure.html#tree-order">tree order</a>.</p>
533: <p>Returns null if <var title="">index</var> is out of range.</p>
534: </dd>
535:
1.42 mike 536: <dt><var title="">element</var> = <var title="">select</var> . <code title="dom-select-item"><a href="http://dev.w3.org/html5/spec/the-button-element.html#dom-select-item" class="full-spec-link" title='Read about this "namedItem" reference in the full HTML5 spec.'>namedItem</a></code>(<var title="">name</var>)</dt>
1.9 mike 537: <dt><var title="">select</var>[<var title="">name</var>]</dt>
538: <dt><var title="">select</var>(<var title="">name</var>)</dt>
539: <dd>
1.28 mike 540: <p>Returns the item with ID or <code title="attr-option-name"><a href="obsolete.html#attr-option-name">name</a></code> <var title="">name</var> from the <a href="#concept-select-option-list" title="concept-select-option-list">list of options</a>.</p>
1.42 mike 541: <p>If there are multiple matching items, then a <code><a href="http://dev.w3.org/html5/spec/infrastructure.html#nodelist" class="full-spec-link" title='Read about this "NodeList" reference in the full HTML5 spec.'>NodeList</a></code> object containing all those elements is returned.</p>
1.9 mike 542: <p>Returns null if no element with that ID could be found.</p>
543: </dd>
544:
1.42 mike 545: <dt><var title="">select</var> . <code title="dom-select-add"><a href="http://dev.w3.org/html5/spec/the-button-element.html#dom-select-add" class="full-spec-link" title='Read about this "add" reference in the full HTML5 spec.'>add</a></code>(<var title="">element</var> [, <var title="">before</var> ])</dt>
1.9 mike 546: <dd>
547: <p>Inserts <var title="">element</var> before the node given by <var title="">before</var>.</p>
548: <p>The <var title="">before</var> argument can be a number, in
549: which case <var title="">element</var> is inserted before the item
550: with that number, or an element from the <a href="#concept-select-option-list" title="concept-select-option-list">list of options</a>, in
551: which case <var title="">element</var> is inserted before that
552: element.</p>
553: <p>If <var title="">before</var> is omitted, null, or a number out
554: of range, then <var title="">element</var> will be added at the
555: end of the list.</p>
556: <p>This method will throw a <code><a href="urls.html#hierarchy_request_err">HIERARCHY_REQUEST_ERR</a></code>
557: exception if <var title="">element</var> is an ancestor of the
558: element into which it is to be inserted. If <var title="">element</var> is not an <code><a href="#the-option-element">option</a></code> or
559: <code><a href="#the-optgroup-element">optgroup</a></code> element, then the method does nothing.</p>
560: </dd>
561:
1.42 mike 562: <dt><var title="">select</var> . <code title="dom-select-selectedOptions"><a href="http://dev.w3.org/html5/spec/the-button-element.html#dom-select-selectedoptions" class="full-spec-link" title='Read about this "selectedOptions" reference in the full HTML5 spec.'>selectedOptions</a></code></dt>
1.9 mike 563:
564: <dd>
565:
566: <p>Returns an <code><a href="urls.html#htmlcollection">HTMLCollection</a></code> of the <a href="#concept-select-option-list" title="concept-select-option-list">list of options</a> that are
567: selected.</p>
568:
569: </dd>
570:
1.42 mike 571: <dt><var title="">select</var> . <code title="dom-select-selectedIndex"><a href="http://dev.w3.org/html5/spec/the-button-element.html#dom-select-selectedindex" class="full-spec-link" title='Read about this "selectedIndex" reference in the full HTML5 spec.'>selectedIndex</a></code> [ = <var title="">value</var> ]</dt>
1.9 mike 572:
573: <dd>
574:
575: <p>Returns the index of the first selected item, if any, or
1.41 mike 576: −1 if there is no selected item.</p>
1.9 mike 577:
578: <p>Can be set, to change the selection.</p>
579:
580: </dd>
581:
1.42 mike 582: <dt><var title="">select</var> . <code title="dom-select-value"><a href="http://dev.w3.org/html5/spec/the-button-element.html#dom-select-value" class="full-spec-link" title='Read about this "value" reference in the full HTML5 spec.'>value</a></code> [ = <var title="">value</var> ]</dt>
1.9 mike 583:
584: <dd>
585:
1.42 mike 586: <p>Returns the <a href="http://dev.w3.org/html5/spec/association-of-controls-and-forms.html#concept-fe-value" title='Read about this "value" reference in the full HTML5 spec.' class="full-spec-link">value</a> of the
1.9 mike 587: first selected item, if any, or the empty string if there is no
588: selected item.</p>
589:
590: <p>Can be set, to change the selection.</p>
591:
592: </dd>
593:
594: </dl><div class="example">
595:
596: <p>The following example shows how a <code><a href="#the-select-element">select</a></code> element
597: can be used to offer the user with a set of options from which the
598: user can select a single option. The default option is
599: preselected.</p>
600:
601: <pre><p>
602: <label for="unittype">Select unit type:</label>
603: <select id="unittype" name="unittype">
604: <option value="1"> Miner </option>
605: <option value="2"> Puffer </option>
606: <option value="3" selected> Snipey </option>
607: <option value="4"> Max </option>
608: <option value="5"> Firebot </option>
609: </select>
610: </p></pre>
611:
612: </div><div class="example">
613:
614: <p>Here, the user is offered a set of options from which he can
615: select any number. By default, all five options are selected.</p>
616:
617: <pre><p>
618: <label for="allowedunits">Select unit types to enable on this map:</label>
619: <select id="allowedunits" name="allowedunits" multiple>
620: <option value="1" selected> Miner </option>
621: <option value="2" selected> Puffer </option>
622: <option value="3" selected> Snipey </option>
623: <option value="4" selected> Max </option>
624: <option value="5" selected> Firebot </option>
625: </select>
626: </p></pre>
627:
1.30 mike 628: </div><h4 id="the-datalist-element"><span class="secno">4.10.10 </span>The <dfn><code>datalist</code></dfn> element</h4><p class="XXX annotation"><b>Status: </b><i>Last call for comments</i></p><dl class="element"><dt>Categories</dt>
1.9 mike 629: <dd><a href="content-models.html#flow-content">Flow content</a>.</dd>
630: <dd><a href="content-models.html#phrasing-content">Phrasing content</a>.</dd>
631: <dt>Contexts in which this element may be used:</dt>
632: <dd>Where <a href="content-models.html#phrasing-content">phrasing content</a> is expected.</dd>
633: <dt>Content model:</dt>
634: <dd>Either: <a href="content-models.html#phrasing-content">phrasing content</a>.</dd>
635: <dd>Or: Zero or more <code><a href="#the-option-element">option</a></code> elements.</dd>
636: <dt>Content attributes:</dt>
637: <dd><a href="elements.html#global-attributes">Global attributes</a></dd>
638: <dt>DOM interface:</dt>
639: <dd>
640: <pre class="idl">interface <dfn id="htmldatalistelement">HTMLDataListElement</dfn> : <a href="elements.html#htmlelement">HTMLElement</a> {
1.42 mike 641: readonly attribute <a href="urls.html#htmlcollection">HTMLCollection</a> <a href="http://dev.w3.org/html5/spec/the-button-element.html#dom-datalist-options" title='Read about this "options" reference in the full HTML5 spec.' class="full-spec-link">options</a>;
1.9 mike 642: };</pre>
643: </dd>
644: </dl><p>The <code><a href="#the-datalist-element">datalist</a></code> element represents a set of
645: <code><a href="#the-option-element">option</a></code> elements that represent predefined options for
646: other controls. The contents of the element represents fallback
647: content for legacy user agents, intermixed with <code><a href="#the-option-element">option</a></code>
648: elements that represent the predefined options. In the rendering,
1.42 mike 649: the <code><a href="#the-datalist-element">datalist</a></code> element <a href="http://dev.w3.org/html5/spec/rendering.html#represents" class="full-spec-link" title='Read about this "represents" reference in the full HTML5 spec.'>represents</a>
1.9 mike 650: nothing.</p><p>The <code><a href="#the-datalist-element">datalist</a></code> element is hooked up to an
651: <code><a href="the-input-element.html#the-input-element">input</a></code> element using the <code title="attr-input-list"><a href="common-input-element-attributes.html#attr-input-list">list</a></code> attribute on the
652: <code><a href="the-input-element.html#the-input-element">input</a></code> element. <!-- v2DATAGRID The
653: <code>datalist</code> element can also be used with a
654: <code>datagrid</code> element, as the source of autocompletion hints
655: for <code title="datagrid-type-editable">editable</code>
656: cells. --></p><p>Each <code><a href="#the-option-element">option</a></code> element that is a descendant of the
657: <code><a href="#the-datalist-element">datalist</a></code> element, that is not <a href="#concept-option-disabled" title="concept-option-disabled">disabled</a>, and whose <a href="#concept-option-value" title="concept-option-value">value</a> is a string that isn't the
658: empty string, represents a suggestion. Each suggestion has a <a href="#concept-option-value" title="concept-option-value">value</a> and a <a href="#concept-option-label" title="concept-option-label">label</a>.
659:
1.42 mike 660: </p><dl class="domintro"><dt><var title="">datalist</var> . <code title="dom-datalist-options"><a href="http://dev.w3.org/html5/spec/the-button-element.html#dom-datalist-options" class="full-spec-link" title='Read about this "options" reference in the full HTML5 spec.'>options</a></code></dt>
1.9 mike 661:
662: <dd>
663: <p>Returns an <code><a href="urls.html#htmlcollection">HTMLCollection</a></code> of the <code>options</code> elements of the table.</p>
664: </dd>
665:
1.30 mike 666: </dl><h4 id="the-optgroup-element"><span class="secno">4.10.11 </span>The <dfn><code>optgroup</code></dfn> element</h4><p class="XXX annotation"><b>Status: </b><i>Last call for comments</i></p><dl class="element"><dt>Categories</dt>
1.9 mike 667: <dd>None.</dd>
668: <dt>Contexts in which this element may be used:</dt>
669: <dd>As a child of a <code><a href="#the-select-element">select</a></code> element.</dd>
670: <dt>Content model:</dt>
671: <dd>Zero or more <code><a href="#the-option-element">option</a></code> elements.</dd>
672: <dt>Content attributes:</dt>
673: <dd><a href="elements.html#global-attributes">Global attributes</a></dd>
674: <dd><code title="attr-optgroup-disabled"><a href="#attr-optgroup-disabled">disabled</a></code></dd>
675: <dd><code title="attr-optgroup-label"><a href="#attr-optgroup-label">label</a></code></dd>
676: <dt>DOM interface:</dt>
677: <dd>
678: <pre class="idl">interface <dfn id="htmloptgroupelement">HTMLOptGroupElement</dfn> : <a href="elements.html#htmlelement">HTMLElement</a> {
1.42 mike 679: attribute boolean <a href="http://dev.w3.org/html5/spec/the-button-element.html#dom-optgroup-disabled" title='Read about this "disabled" reference in the full HTML5 spec.' class="full-spec-link">disabled</a>;
680: attribute DOMString <a href="http://dev.w3.org/html5/spec/the-button-element.html#dom-optgroup-label" title='Read about this "label" reference in the full HTML5 spec.' class="full-spec-link">label</a>;
1.9 mike 681: };</pre>
682: </dd>
1.42 mike 683: </dl><!-- v2: make optgroups selectable if they have a value. --><p>The <code><a href="#the-optgroup-element">optgroup</a></code> element <a href="http://dev.w3.org/html5/spec/rendering.html#represents" class="full-spec-link" title='Read about this "represents" reference in the full HTML5 spec.'>represents</a> a group of
1.9 mike 684: <code><a href="#the-option-element">option</a></code> elements with a common label.</p><p>The element's group of <code><a href="#the-option-element">option</a></code> elements consists of
685: the <code><a href="#the-option-element">option</a></code> elements that are children of the
686: <code><a href="#the-optgroup-element">optgroup</a></code> element.</p><p>The <dfn id="attr-optgroup-disabled" title="attr-optgroup-disabled"><code>disabled</code></dfn> attribute
687: is a <a href="common-microsyntaxes.html#boolean-attribute">boolean attribute</a> and can be used to <a href="#concept-option-disabled" title="concept-option-disabled">disable</a> a group of
688: <code><a href="#the-option-element">option</a></code> elements together.</p><p>The <dfn id="attr-optgroup-label" title="attr-optgroup-label"><code>label</code></dfn>
689: attribute must be specified. Its value gives the name of the group,
690: for the purposes of the user interface. </p><div class="example">
691:
692: <p>The following snippet shows how a set of lessons from three
693: courses could be offered in a <code><a href="#the-select-element">select</a></code> drop-down
694: widget:</p>
695:
696: <pre><form action="courseselector.dll" method="get">
697: <p>Which course would you like to watch today?
698: <p><label>Course:
699: <select name="c">
700: <optgroup label="8.01 Physics I: Classical Mechanics">
701: <option value="8.01.1">Lecture 01: Powers of Ten
702: <option value="8.01.2">Lecture 02: 1D Kinematics
703: <option value="8.01.3">Lecture 03: Vectors
704: <optgroup label="8.02 Electricity and Magnestism">
705: <option value="8.02.1">Lecture 01: What holds our world together?
706: <option value="8.02.2">Lecture 02: Electric Field
707: <option value="8.02.3">Lecture 03: Electric Flux
708: <optgroup label="8.03 Physics III: Vibrations and Waves">
709: <option value="8.03.1">Lecture 01: Periodic Phenomenon
710: <option value="8.03.2">Lecture 02: Beats
711: <option value="8.03.3">Lecture 03: Forced Oscillations with Damping
712: </select>
713: </label>
1.41 mike 714: <p><input type=submit value="â–¶ Play">
1.9 mike 715: </form></pre>
716:
1.30 mike 717: </div><h4 id="the-option-element"><span class="secno">4.10.12 </span>The <dfn><code>option</code></dfn> element</h4><p class="XXX annotation"><b>Status: </b><i>Last call for comments</i></p><dl class="element"><dt>Categories</dt>
1.9 mike 718: <dd>None.</dd>
719: <dt>Contexts in which this element may be used:</dt>
720: <dd>As a child of a <code><a href="#the-select-element">select</a></code> element.</dd>
721: <dd>As a child of a <code><a href="#the-datalist-element">datalist</a></code> element.</dd>
722: <dd>As a child of an <code><a href="#the-optgroup-element">optgroup</a></code> element.</dd>
723: <dt>Content model:</dt>
724: <dd><a href="content-models.html#text-content" title="text content">Text</a>.</dd>
725: <dt>Content attributes:</dt>
726: <dd><a href="elements.html#global-attributes">Global attributes</a></dd>
727: <dd><code title="attr-option-disabled"><a href="#attr-option-disabled">disabled</a></code></dd>
728: <dd><code title="attr-option-label"><a href="#attr-option-label">label</a></code></dd>
729: <dd><code title="attr-option-selected"><a href="#attr-option-selected">selected</a></code></dd>
730: <dd><code title="attr-option-value"><a href="#attr-option-value">value</a></code></dd>
731: <dt>DOM interface:</dt>
732: <dd>
1.42 mike 733: <pre class="idl">[NamedConstructor=<a href="http://dev.w3.org/html5/spec/the-button-element.html#dom-option" title='Read about this "Option" reference in the full HTML5 spec.' class="full-spec-link">Option</a>(),
734: NamedConstructor=<a href="http://dev.w3.org/html5/spec/the-button-element.html#dom-option-t" title='Read about this "Option" reference in the full HTML5 spec.' class="full-spec-link">Option</a>(in DOMString text),
735: NamedConstructor=<a href="http://dev.w3.org/html5/spec/the-button-element.html#dom-option-tv" title='Read about this "Option" reference in the full HTML5 spec.' class="full-spec-link">Option</a>(in DOMString text, in DOMString value),
736: NamedConstructor=<a href="http://dev.w3.org/html5/spec/the-button-element.html#dom-option-tvd" title='Read about this "Option" reference in the full HTML5 spec.' class="full-spec-link">Option</a>(in DOMString text, in DOMString value, in boolean defaultSelected),
737: NamedConstructor=<a href="http://dev.w3.org/html5/spec/the-button-element.html#dom-option-tvds" title='Read about this "Option" reference in the full HTML5 spec.' class="full-spec-link">Option</a>(in DOMString text, in DOMString value, in boolean defaultSelected, in boolean selected)]
1.9 mike 738: interface <dfn id="htmloptionelement">HTMLOptionElement</dfn> : <a href="elements.html#htmlelement">HTMLElement</a> {
1.42 mike 739: attribute boolean <a href="http://dev.w3.org/html5/spec/the-button-element.html#dom-option-disabled" title='Read about this "disabled" reference in the full HTML5 spec.' class="full-spec-link">disabled</a>;
740: readonly attribute <a href="forms.html#htmlformelement">HTMLFormElement</a> <a href="http://dev.w3.org/html5/spec/the-button-element.html#dom-option-form" title='Read about this "form" reference in the full HTML5 spec.' class="full-spec-link">form</a>;
741: attribute DOMString <a href="http://dev.w3.org/html5/spec/the-button-element.html#dom-option-label" title='Read about this "label" reference in the full HTML5 spec.' class="full-spec-link">label</a>;
742: attribute boolean <a href="http://dev.w3.org/html5/spec/the-button-element.html#dom-option-defaultselected" title='Read about this "defaultSelected" reference in the full HTML5 spec.' class="full-spec-link">defaultSelected</a>;
743: attribute boolean <a href="http://dev.w3.org/html5/spec/the-button-element.html#dom-option-selected" title='Read about this "selected" reference in the full HTML5 spec.' class="full-spec-link">selected</a>;
744: attribute DOMString <a href="http://dev.w3.org/html5/spec/the-button-element.html#dom-option-value" title='Read about this "value" reference in the full HTML5 spec.' class="full-spec-link">value</a>;
1.9 mike 745:
1.42 mike 746: attribute DOMString <a href="http://dev.w3.org/html5/spec/the-button-element.html#dom-option-text" title='Read about this "text" reference in the full HTML5 spec.' class="full-spec-link">text</a>;
747: readonly attribute long <a href="http://dev.w3.org/html5/spec/the-button-element.html#dom-option-index" title='Read about this "index" reference in the full HTML5 spec.' class="full-spec-link">index</a>;
1.9 mike 748: };</pre>
749: </dd>
1.42 mike 750: </dl><p>The <code><a href="#the-option-element">option</a></code> element <a href="http://dev.w3.org/html5/spec/rendering.html#represents" class="full-spec-link" title='Read about this "represents" reference in the full HTML5 spec.'>represents</a> an option
1.9 mike 751: in a <code><a href="#the-select-element">select</a></code> element or as part of a list of suggestions
752: in a <code><a href="#the-datalist-element">datalist</a></code> element.</p><p>The <dfn id="attr-option-disabled" title="attr-option-disabled"><code>disabled</code></dfn>
753: attribute is a <a href="common-microsyntaxes.html#boolean-attribute">boolean attribute</a>. An
754: <code><a href="#the-option-element">option</a></code> element is <dfn id="concept-option-disabled" title="concept-option-disabled">disabled</dfn> if its <code title="attr-option-disabled"><a href="#attr-option-disabled">disabled</a></code> attribute is present or
755: if it is a child of an <code><a href="#the-optgroup-element">optgroup</a></code> element whose <code title="attr-optgroup-disabled"><a href="#attr-optgroup-disabled">disabled</a></code> attribute is
756: present.</p><p>The <dfn id="attr-option-label" title="attr-option-label"><code>label</code></dfn>
757: attribute provides a label for element. The <dfn id="concept-option-label" title="concept-option-label">label</dfn> of an <code><a href="#the-option-element">option</a></code>
758: element is the value of the <code title="attr-option-label"><a href="#attr-option-label">label</a></code> attribute, if there is one,
1.42 mike 759: or the <code><a href="http://dev.w3.org/html5/spec/infrastructure.html#textcontent" class="full-spec-link" title='Read about this "textContent" reference in the full HTML5 spec.'>textContent</a></code> of the element, if there isn't.</p><p>The <dfn id="attr-option-value" title="attr-option-value"><code>value</code></dfn>
1.9 mike 760: attribute provides a value for element. The <dfn id="concept-option-value" title="concept-option-value">value</dfn> of an <code><a href="#the-option-element">option</a></code>
761: element is the value of the <code title="attr-option-value"><a href="#attr-option-value">value</a></code> attribute, if there is one,
1.42 mike 762: or the <code><a href="http://dev.w3.org/html5/spec/infrastructure.html#textcontent" class="full-spec-link" title='Read about this "textContent" reference in the full HTML5 spec.'>textContent</a></code> of the element, if there isn't.</p><p>The <dfn id="attr-option-selected" title="attr-option-selected"><code>selected</code></dfn>
763: attribute represents the default <a href="http://dev.w3.org/html5/spec/the-button-element.html#concept-option-selectedness" title='Read about this "selectedness" reference in the full HTML5 spec.' class="full-spec-link">selectedness</a> of the
1.33 mike 764: element.</p><p>A <code><a href="#the-select-element">select</a></code> element whose <code title="attr-select-multiple"><a href="#attr-select-multiple">multiple</a></code> attribute is not
765: specified must not have more than one descendant <code><a href="#the-option-element">option</a></code>
766: element with its <code title="attr-option-selected"><a href="#attr-option-selected">selected</a></code>
1.42 mike 767: attribute set.</p><dl class="domintro"><dt><var title="">option</var> . <code title="dom-option-selected"><a href="http://dev.w3.org/html5/spec/the-button-element.html#dom-option-selected" class="full-spec-link" title='Read about this "selected" reference in the full HTML5 spec.'>selected</a></code></dt>
1.9 mike 768:
769: <dd>
770:
771: <p>Returns true if the element is selected, and false otherwise.</p>
772:
773: </dd>
774:
1.42 mike 775: <dt><var title="">option</var> . <code title="dom-option-index"><a href="http://dev.w3.org/html5/spec/the-button-element.html#dom-option-index" class="full-spec-link" title='Read about this "index" reference in the full HTML5 spec.'>index</a></code></dt>
1.9 mike 776:
777: <dd>
778:
779: <p>Returns the index of the element in its <code><a href="#the-select-element">select</a></code>
1.42 mike 780: element's <code title="dom-select-options"><a href="http://dev.w3.org/html5/spec/the-button-element.html#dom-select-options" class="full-spec-link" title='Read about this "options" reference in the full HTML5 spec.'>options</a></code>
1.9 mike 781: list.</p>
782:
783: </dd>
784:
1.42 mike 785: <dt><var title="">option</var> . <code title="dom-option-form"><a href="http://dev.w3.org/html5/spec/the-button-element.html#dom-option-form" class="full-spec-link" title='Read about this "form" reference in the full HTML5 spec.'>form</a></code></dt>
1.9 mike 786:
787: <dd>
788:
789: <p>Returns the element's <code><a href="forms.html#the-form-element">form</a></code> element, if any, or
790: null otherwise.</p>
791:
792: </dd>
793:
1.42 mike 794: <dt><var title="">option</var> . <code title="dom-option-text"><a href="http://dev.w3.org/html5/spec/the-button-element.html#dom-option-text" class="full-spec-link" title='Read about this "text" reference in the full HTML5 spec.'>text</a></code></dt>
1.11 mike 795:
796: <dd>
797:
1.42 mike 798: <p>Same as <code><a href="http://dev.w3.org/html5/spec/infrastructure.html#textcontent" class="full-spec-link" title='Read about this "textContent" reference in the full HTML5 spec.'>textContent</a></code>.</p>
1.11 mike 799:
800: </dd>
801:
1.42 mike 802: <dt><var title="">option</var> = new <code title="dom-option"><a href="http://dev.w3.org/html5/spec/the-button-element.html#dom-option" class="full-spec-link" title='Read about this "Option" reference in the full HTML5 spec.'>Option</a></code>( [ <var title="">text</var> [, <var title="">value</var> [, <var title="">defaultSelected</var> [, <var title="">selected</var> ] ] ] ] )</dt>
1.9 mike 803:
804: <dd>
805:
806: <p>Returns a new <code><a href="#the-option-element">option</a></code> element.</p>
807:
808: <p>The <var title="">text</var> argument sets the contents of the element.</p>
809: <p>The <var title="">value</var> argument sets the <code title="attr-option-value"><a href="#attr-option-value">value</a></code> attribute.</p>
810: <p>The <var title="">defaultSelected</var> argument sets the <code title="attr-option-selected"><a href="#attr-option-selected">selected</a></code> attribute.</p>
811: <p>The <var title="">selected</var> argument sets whether or not the element is selected. If it is omitted, even if the <var title="">defaultSelected</var> argument is true, the element is not selected.</p>
812:
813: </dd>
814:
1.30 mike 815: </dl><h4 id="the-textarea-element"><span class="secno">4.10.13 </span>The <dfn><code>textarea</code></dfn> element</h4><p class="XXX annotation"><b>Status: </b><i>Last call for comments</i></p><dl class="element"><dt>Categories</dt>
1.9 mike 816: <dd><a href="content-models.html#flow-content">Flow content</a>.</dd>
817: <dd><a href="content-models.html#phrasing-content">Phrasing content</a>.</dd>
818: <dd><a href="content-models.html#interactive-content">Interactive content</a>.</dd>
819: <dd><a href="forms.html#category-listed" title="category-listed">Listed</a>, <a href="forms.html#category-label" title="category-label">labelable</a>, <a href="forms.html#category-submit" title="category-submit">submittable</a>, and <a href="forms.html#category-reset" title="category-reset">resettable</a> <a href="forms.html#form-associated-element">form-associated element</a>.</dd>
820: <dt>Contexts in which this element may be used:</dt>
821: <dd>Where <a href="content-models.html#phrasing-content">phrasing content</a> is expected.</dd>
822: <dt>Content model:</dt>
823: <dd><a href="content-models.html#text-content" title="text content">Text</a>.</dd>
824: <dt>Content attributes:</dt>
825: <dd><a href="elements.html#global-attributes">Global attributes</a></dd>
826: <dd><code title="attr-fe-autofocus"><a href="association-of-controls-and-forms.html#attr-fe-autofocus">autofocus</a></code></dd>
827: <dd><code title="attr-textarea-cols"><a href="#attr-textarea-cols">cols</a></code></dd>
828: <dd><code title="attr-fe-disabled"><a href="association-of-controls-and-forms.html#attr-fe-disabled">disabled</a></code></dd>
829: <dd><code title="attr-fae-form"><a href="association-of-controls-and-forms.html#attr-fae-form">form</a></code></dd>
830: <dd><code title="attr-textarea-maxlength"><a href="#attr-textarea-maxlength">maxlength</a></code></dd>
831: <dd><code title="attr-fe-name"><a href="association-of-controls-and-forms.html#attr-fe-name">name</a></code></dd>
832: <dd><code title="attr-textarea-placeholder"><a href="#attr-textarea-placeholder">placeholder</a></code></dd>
833: <dd><code title="attr-textarea-readonly"><a href="#attr-textarea-readonly">readonly</a></code></dd>
834: <dd><code title="attr-textarea-required"><a href="#attr-textarea-required">required</a></code></dd>
835: <dd><code title="attr-textarea-rows"><a href="#attr-textarea-rows">rows</a></code></dd>
836: <dd><code title="attr-textarea-wrap"><a href="#attr-textarea-wrap">wrap</a></code></dd>
837: <dt>DOM interface:</dt>
838: <dd>
839: <pre class="idl">interface <dfn id="htmltextareaelement">HTMLTextAreaElement</dfn> : <a href="elements.html#htmlelement">HTMLElement</a> {
1.42 mike 840: attribute boolean <a href="http://dev.w3.org/html5/spec/association-of-controls-and-forms.html#dom-fe-autofocus" title='Read about this "autofocus" reference in the full HTML5 spec.' class="full-spec-link">autofocus</a>;
841: attribute unsigned long <a href="http://dev.w3.org/html5/spec/the-button-element.html#dom-textarea-cols" title='Read about this "cols" reference in the full HTML5 spec.' class="full-spec-link">cols</a>;
842: attribute boolean <a href="http://dev.w3.org/html5/spec/association-of-controls-and-forms.html#dom-fe-disabled" title='Read about this "disabled" reference in the full HTML5 spec.' class="full-spec-link">disabled</a>;
843: readonly attribute <a href="forms.html#htmlformelement">HTMLFormElement</a> <a href="http://dev.w3.org/html5/spec/association-of-controls-and-forms.html#dom-fae-form" title='Read about this "form" reference in the full HTML5 spec.' class="full-spec-link">form</a>;
844: attribute long <a href="http://dev.w3.org/html5/spec/the-button-element.html#dom-textarea-maxlength" title='Read about this "maxLength" reference in the full HTML5 spec.' class="full-spec-link">maxLength</a>;
845: attribute DOMString <a href="http://dev.w3.org/html5/spec/association-of-controls-and-forms.html#dom-fe-name" title='Read about this "name" reference in the full HTML5 spec.' class="full-spec-link">name</a>;
846: attribute DOMString <a href="http://dev.w3.org/html5/spec/the-button-element.html#dom-textarea-placeholder" title='Read about this "placeholder" reference in the full HTML5 spec.' class="full-spec-link">placeholder</a>;
847: attribute boolean <a href="http://dev.w3.org/html5/spec/the-button-element.html#dom-textarea-readonly" title='Read about this "readOnly" reference in the full HTML5 spec.' class="full-spec-link">readOnly</a>;
848: attribute boolean <a href="http://dev.w3.org/html5/spec/the-button-element.html#dom-textarea-required" title='Read about this "required" reference in the full HTML5 spec.' class="full-spec-link">required</a>;
849: attribute unsigned long <a href="http://dev.w3.org/html5/spec/the-button-element.html#dom-textarea-rows" title='Read about this "rows" reference in the full HTML5 spec.' class="full-spec-link">rows</a>;
850: attribute DOMString <a href="http://dev.w3.org/html5/spec/the-button-element.html#dom-textarea-wrap" title='Read about this "wrap" reference in the full HTML5 spec.' class="full-spec-link">wrap</a>;
851:
852: readonly attribute DOMString <a href="http://dev.w3.org/html5/spec/the-button-element.html#dom-textarea-type" title='Read about this "type" reference in the full HTML5 spec.' class="full-spec-link">type</a>;
853: attribute DOMString <a href="http://dev.w3.org/html5/spec/the-button-element.html#dom-textarea-defaultvalue" title='Read about this "defaultValue" reference in the full HTML5 spec.' class="full-spec-link">defaultValue</a>;
854: attribute DOMString <a href="http://dev.w3.org/html5/spec/the-button-element.html#dom-textarea-value" title='Read about this "value" reference in the full HTML5 spec.' class="full-spec-link">value</a>;
855: readonly attribute unsigned long <a href="http://dev.w3.org/html5/spec/the-button-element.html#dom-textarea-textlength" title='Read about this "textLength" reference in the full HTML5 spec.' class="full-spec-link">textLength</a>;
856:
857: readonly attribute boolean <a href="http://dev.w3.org/html5/spec/association-of-controls-and-forms.html#dom-cva-willvalidate" title='Read about this "willValidate" reference in the full HTML5 spec.' class="full-spec-link">willValidate</a>;
858: readonly attribute <a href="http://dev.w3.org/html5/spec/association-of-controls-and-forms.html#validitystate" class="full-spec-link" title='Read about this "ValidityState" reference in the full HTML5 spec.'>ValidityState</a> <a href="http://dev.w3.org/html5/spec/association-of-controls-and-forms.html#dom-cva-validity" title='Read about this "validity" reference in the full HTML5 spec.' class="full-spec-link">validity</a>;
859: readonly attribute DOMString <a href="http://dev.w3.org/html5/spec/association-of-controls-and-forms.html#dom-cva-validationmessage" title='Read about this "validationMessage" reference in the full HTML5 spec.' class="full-spec-link">validationMessage</a>;
860: boolean <a href="http://dev.w3.org/html5/spec/association-of-controls-and-forms.html#dom-cva-checkvalidatity" title='Read about this "checkValidity" reference in the full HTML5 spec.' class="full-spec-link">checkValidity</a>();
861: void <a href="http://dev.w3.org/html5/spec/association-of-controls-and-forms.html#dom-cva-setcustomvalidity" title='Read about this "setCustomValidity" reference in the full HTML5 spec.' class="full-spec-link">setCustomValidity</a>(in DOMString error);
862:
863: readonly attribute <a href="http://dev.w3.org/html5/spec/infrastructure.html#nodelist" class="full-spec-link" title='Read about this "NodeList" reference in the full HTML5 spec.'>NodeList</a> <a href="http://dev.w3.org/html5/spec/forms.html#dom-lfe-labels" title='Read about this "labels" reference in the full HTML5 spec.' class="full-spec-link">labels</a>;
864:
865: void <a href="http://dev.w3.org/html5/spec/editing.html#dom-textarea-input-select" title='Read about this "select" reference in the full HTML5 spec.' class="full-spec-link">select</a>();
866: attribute unsigned long <a href="http://dev.w3.org/html5/spec/editing.html#dom-textarea-input-selectionstart" title='Read about this "selectionStart" reference in the full HTML5 spec.' class="full-spec-link">selectionStart</a>;
867: attribute unsigned long <a href="http://dev.w3.org/html5/spec/editing.html#dom-textarea-input-selectionend" title='Read about this "selectionEnd" reference in the full HTML5 spec.' class="full-spec-link">selectionEnd</a>;
868: void <a href="http://dev.w3.org/html5/spec/editing.html#dom-textarea-input-setselectionrange" title='Read about this "setSelectionRange" reference in the full HTML5 spec.' class="full-spec-link">setSelectionRange</a>(in unsigned long start, in unsigned long end);
1.9 mike 869: };</pre>
870: </dd>
1.42 mike 871: </dl><p>The <code><a href="#the-textarea-element">textarea</a></code> element <a href="http://dev.w3.org/html5/spec/rendering.html#represents" class="full-spec-link" title='Read about this "represents" reference in the full HTML5 spec.'>represents</a> a
1.9 mike 872: multiline plain text edit control. The contents of the control represent the
873: control's default value.</p><p>The <dfn id="attr-textarea-readonly" title="attr-textarea-readonly"><code>readonly</code></dfn> attribute
874: is a <a href="common-microsyntaxes.html#boolean-attribute">boolean attribute</a> used to control whether the text
875: can be edited by the user or not.</p><p>The <dfn id="attr-textarea-cols" title="attr-textarea-cols"><code>cols</code></dfn>
876: attribute specifies the expected maximum number of characters per
877: line. If the <code title="attr-textarea-cols"><a href="#attr-textarea-cols">cols</a></code> attribute
878: is specified, its value must be a <a href="common-microsyntaxes.html#valid-non-negative-integer">valid non-negative
879: integer</a> greater than zero. </p><p>The <dfn id="attr-textarea-rows" title="attr-textarea-rows"><code>rows</code></dfn>
880: attribute specifies the number of lines to show. If the <code title="attr-textarea-rows"><a href="#attr-textarea-rows">rows</a></code> attribute is specified, its
881: value must be a <a href="common-microsyntaxes.html#valid-non-negative-integer">valid non-negative integer</a> greater than
882: zero. </p><p>The <dfn id="attr-textarea-wrap" title="attr-textarea-wrap"><code>wrap</code></dfn>
883: attribute is an <a href="common-microsyntaxes.html#enumerated-attribute">enumerated attribute</a> with two keywords
884: and states: the <dfn id="attr-textarea-wrap-soft" title="attr-textarea-wrap-soft"><code>soft</code></dfn> keyword
885: which maps to the <dfn id="attr-textarea-wrap-soft-state" title="attr-textarea-wrap-soft-state">Soft</dfn> state, and the
886: <dfn id="attr-textarea-wrap-hard" title="attr-textarea-wrap-hard"><code>hard</code></dfn> keyword
887: which maps to the <dfn id="attr-textarea-wrap-hard-state" title="attr-textarea-wrap-hard-state">Hard</dfn> state. The
888: <i>missing value default</i> is the <a href="#attr-textarea-wrap-soft-state" title="attr-textarea-wrap-soft-state">Soft</a> state.</p><p>If the element's <code title="attr-textarea-wrap"><a href="#attr-textarea-wrap">wrap</a></code>
889: attribute is in the <a href="#attr-textarea-wrap-hard-state" title="attr-textarea-wrap-hard-state">Hard</a> state, the <code title="attr-textarea-cols"><a href="#attr-textarea-cols">cols</a></code> attribute must be
890: specified.</p><!-- attr-textarea-wrap-off (attr-textarea-wrap-off-state): not
891: conforming; turns off the rendering of wrapping but otherwise acts
892: like 'soft' --><p>The <dfn id="attr-textarea-maxlength" title="attr-textarea-maxlength"><code>maxlength</code></dfn>
893: attribute is a <a href="association-of-controls-and-forms.html#attr-fe-maxlength" title="attr-fe-maxlength">form control <code title="">maxlength</code> attribute</a> controlled by the
1.42 mike 894: <code><a href="#the-textarea-element">textarea</a></code> element's <a href="http://dev.w3.org/html5/spec/the-button-element.html#concept-textarea-dirty" title='Read about this "dirty value flag" reference in the full HTML5 spec.' class="full-spec-link">dirty value flag</a>.</p><p>If the <code><a href="#the-textarea-element">textarea</a></code> element has a <a href="association-of-controls-and-forms.html#maximum-allowed-value-length">maximum allowed
1.9 mike 895: value length</a>, then the element's children must be such that
1.42 mike 896: the <a href="http://dev.w3.org/html5/spec/common-microsyntaxes.html#code-point-length" class="full-spec-link" title='Read about this "code-point length" reference in the full HTML5 spec.'>code-point length</a> of the value of the element's
897: <code><a href="http://dev.w3.org/html5/spec/infrastructure.html#textcontent" class="full-spec-link" title='Read about this "textContent" reference in the full HTML5 spec.'>textContent</a></code> IDL attribute is equal to or less than the
1.9 mike 898: element's <a href="association-of-controls-and-forms.html#maximum-allowed-value-length">maximum allowed value length</a>.</p><p>The <dfn id="attr-textarea-required" title="attr-textarea-required"><code>required</code></dfn> attribute
899: is a <a href="common-microsyntaxes.html#boolean-attribute">boolean attribute</a>. When specified, the user will
900: be required to enter a value before submitting the form.</p><!-- similar text in the <input> section --><p>The <dfn id="attr-textarea-placeholder" title="attr-textarea-placeholder"><code>placeholder</code></dfn>
901: attribute represents a hint (a word or short phrase) intended to aid
902: the user with data entry. A hint could be a sample value or a brief
903: description of the expected format. The attribute, if specified,
904: must have a value that contains no U+000A LINE FEED (LF) or U+000D
905: CARRIAGE RETURN (CR) characters.</p><p class="note">For a longer hint or other advisory text, the <code title="attr-title"><a href="elements.html#the-title-attribute">title</a></code> attribute is more appropriate.</p><p>The <code title="attr-textarea-placeholder"><a href="#attr-textarea-placeholder">placeholder</a></code>
906: attribute should not be used as an alternative to a
907: <code><a href="forms.html#the-label-element">label</a></code>.</p><p>The <code title="attr-fae-form"><a href="association-of-controls-and-forms.html#attr-fae-form">form</a></code> attribute is used to
908: explicitly associate the <code><a href="#the-textarea-element">textarea</a></code> element with its
909: <a href="association-of-controls-and-forms.html#form-owner">form owner</a>. The <code title="attr-fe-name"><a href="association-of-controls-and-forms.html#attr-fe-name">name</a></code>
910: attribute represents the element's name. The <code title="attr-fe-disabled"><a href="association-of-controls-and-forms.html#attr-fe-disabled">disabled</a></code> attribute is used to make
911: the control non-interactive and to prevent its value from being
912: submitted. The <code title="attr-fe-autofocus"><a href="association-of-controls-and-forms.html#attr-fe-autofocus">autofocus</a></code>
913: attribute controls focus.</p><dl class="domintro"><dt><var title="">textarea</var> . <code title="attr-textarea-type">type</code></dt>
914:
915: <dd>
916:
917: <p>Returns the string "<code title="">textarea</code>".</p>
918:
919: </dd>
920:
921: <dt><var title="">textarea</var> . <code title="attr-textarea-value">value</code></dt>
922:
923: <dd>
924:
925: <p>Returns the current value of the element.</p>
926:
927: <p>Can be set, to change the value.</p>
928:
929: </dd>
930:
931: </dl><div class="example">
932:
933: <p>Here is an example of a <code><a href="#the-textarea-element">textarea</a></code> being used for
934: unrestricted free-form text input in a form:</p>
935:
936: <pre><p>If you have any comments, please let us know: <textarea cols=80 name=comments></textarea></p></pre>
937:
1.30 mike 938: </div><h4 id="the-keygen-element"><span class="secno">4.10.14 </span>The <dfn><code>keygen</code></dfn> element</h4><p class="XXX annotation"><b>Status: </b><i>Last call for comments</i></p><dl class="element"><dt>Categories</dt>
1.9 mike 939: <dd><a href="content-models.html#flow-content">Flow content</a>.</dd>
940: <dd><a href="content-models.html#phrasing-content">Phrasing content</a>.</dd>
941: <dd><a href="content-models.html#interactive-content">Interactive content</a>.</dd>
942: <dd><a href="forms.html#category-listed" title="category-listed">Listed</a>, <a href="forms.html#category-label" title="category-label">labelable</a>, <a href="forms.html#category-submit" title="category-submit">submittable</a>, and <a href="forms.html#category-reset" title="category-reset">resettable</a> <a href="forms.html#form-associated-element">form-associated element</a>.</dd>
943: <dt>Contexts in which this element may be used:</dt>
944: <dd>Where <a href="content-models.html#phrasing-content">phrasing content</a> is expected.</dd>
945: <dt>Content model:</dt>
946: <dd>Empty.</dd>
947: <dt>Content attributes:</dt>
948: <dd><a href="elements.html#global-attributes">Global attributes</a></dd>
949: <dd><code title="attr-fe-autofocus"><a href="association-of-controls-and-forms.html#attr-fe-autofocus">autofocus</a></code></dd>
950: <dd><code title="attr-keygen-challenge"><a href="#attr-keygen-challenge">challenge</a></code></dd>
951: <dd><code title="attr-fe-disabled"><a href="association-of-controls-and-forms.html#attr-fe-disabled">disabled</a></code></dd>
952: <dd><code title="attr-fae-form"><a href="association-of-controls-and-forms.html#attr-fae-form">form</a></code></dd>
953: <dd><code title="attr-keygen-keytype"><a href="#attr-keygen-keytype">keytype</a></code></dd>
954: <dd><code title="attr-fe-name"><a href="association-of-controls-and-forms.html#attr-fe-name">name</a></code></dd>
955: <dt>DOM interface:</dt>
956: <dd>
957: <pre class="idl">interface <dfn id="htmlkeygenelement">HTMLKeygenElement</dfn> : <a href="elements.html#htmlelement">HTMLElement</a> {
1.42 mike 958: attribute boolean <a href="http://dev.w3.org/html5/spec/association-of-controls-and-forms.html#dom-fe-autofocus" title='Read about this "autofocus" reference in the full HTML5 spec.' class="full-spec-link">autofocus</a>;
959: attribute DOMString <a href="http://dev.w3.org/html5/spec/the-button-element.html#dom-keygen-challenge" title='Read about this "challenge" reference in the full HTML5 spec.' class="full-spec-link">challenge</a>;
960: attribute boolean <a href="http://dev.w3.org/html5/spec/association-of-controls-and-forms.html#dom-fe-disabled" title='Read about this "disabled" reference in the full HTML5 spec.' class="full-spec-link">disabled</a>;
961: readonly attribute <a href="forms.html#htmlformelement">HTMLFormElement</a> <a href="http://dev.w3.org/html5/spec/association-of-controls-and-forms.html#dom-fae-form" title='Read about this "form" reference in the full HTML5 spec.' class="full-spec-link">form</a>;
962: attribute DOMString <a href="http://dev.w3.org/html5/spec/the-button-element.html#dom-keygen-keytype" title='Read about this "keytype" reference in the full HTML5 spec.' class="full-spec-link">keytype</a>;
963: attribute DOMString <a href="http://dev.w3.org/html5/spec/association-of-controls-and-forms.html#dom-fe-name" title='Read about this "name" reference in the full HTML5 spec.' class="full-spec-link">name</a>;
964:
965: readonly attribute DOMString <a href="http://dev.w3.org/html5/spec/the-button-element.html#dom-keygen-type" title='Read about this "type" reference in the full HTML5 spec.' class="full-spec-link">type</a>;
966:
967: readonly attribute boolean <a href="http://dev.w3.org/html5/spec/association-of-controls-and-forms.html#dom-cva-willvalidate" title='Read about this "willValidate" reference in the full HTML5 spec.' class="full-spec-link">willValidate</a>;
968: readonly attribute <a href="http://dev.w3.org/html5/spec/association-of-controls-and-forms.html#validitystate" class="full-spec-link" title='Read about this "ValidityState" reference in the full HTML5 spec.'>ValidityState</a> <a href="http://dev.w3.org/html5/spec/association-of-controls-and-forms.html#dom-cva-validity" title='Read about this "validity" reference in the full HTML5 spec.' class="full-spec-link">validity</a>;
969: readonly attribute DOMString <a href="http://dev.w3.org/html5/spec/association-of-controls-and-forms.html#dom-cva-validationmessage" title='Read about this "validationMessage" reference in the full HTML5 spec.' class="full-spec-link">validationMessage</a>;
970: boolean <a href="http://dev.w3.org/html5/spec/association-of-controls-and-forms.html#dom-cva-checkvalidatity" title='Read about this "checkValidity" reference in the full HTML5 spec.' class="full-spec-link">checkValidity</a>();
971: void <a href="http://dev.w3.org/html5/spec/association-of-controls-and-forms.html#dom-cva-setcustomvalidity" title='Read about this "setCustomValidity" reference in the full HTML5 spec.' class="full-spec-link">setCustomValidity</a>(in DOMString error);
1.9 mike 972:
1.42 mike 973: readonly attribute <a href="http://dev.w3.org/html5/spec/infrastructure.html#nodelist" class="full-spec-link" title='Read about this "NodeList" reference in the full HTML5 spec.'>NodeList</a> <a href="http://dev.w3.org/html5/spec/forms.html#dom-lfe-labels" title='Read about this "labels" reference in the full HTML5 spec.' class="full-spec-link">labels</a>;
1.9 mike 974: };</pre>
975: </dd>
1.42 mike 976: </dl><p>The <code><a href="#the-keygen-element">keygen</a></code> element <a href="http://dev.w3.org/html5/spec/rendering.html#represents" class="full-spec-link" title='Read about this "represents" reference in the full HTML5 spec.'>represents</a> a key
1.9 mike 977: pair generator control. When the control's form is submitted, the
978: private key is stored in the local keystore, and the public key is
979: packaged and sent to the server.</p><p>The <dfn id="attr-keygen-challenge" title="attr-keygen-challenge"><code>challenge</code></dfn> attribute
980: may be specified. Its value will be packaged with the submitted
981: key.</p><p>The <dfn id="attr-keygen-keytype" title="attr-keygen-keytype"><code>keytype</code></dfn>
982: attribute is an <a href="common-microsyntaxes.html#enumerated-attribute">enumerated attribute</a>. The following
1.41 mike 983: table lists the keywords and states for the attribute — the
1.9 mike 984: keywords in the left column map to the states listed in the cell in
985: the second column on the same row as the keyword. User agents are
1.26 mike 986: not required to support these values, and must only recognize values
1.9 mike 987: whose corresponding algorithms they support.</p><table><thead><tr><th> Keyword </th><th> State
988: </th></tr></thead><tbody><tr><td> <code title="">rsa</code>
989: </td><td> <i title="">RSA</i>
990: <!-- v2 (see below)
991: <tr>
992: <td> <code title="">ec</code>
993: <td> <i title="">EC</i>
994: -->
995: </td></tr></tbody></table><p>The <i>invalid value default</i> state is the <i title="">unknown</i> state. The <i>missing value default</i> state
996: is the <i title="">RSA</i> state, if it is supported, or the <i title="">unknown</i> state otherwise.</p><p class="note">This specification does not specify what key types
1.41 mike 997: user agents are to support — it is possible for a user agent
1.9 mike 998: to not support any key types at all.</p><p>The <code title="attr-fae-form"><a href="association-of-controls-and-forms.html#attr-fae-form">form</a></code> attribute is used to
999: explicitly associate the <code><a href="#the-keygen-element">keygen</a></code> element with its
1000: <a href="association-of-controls-and-forms.html#form-owner">form owner</a>. The <code title="attr-fe-name"><a href="association-of-controls-and-forms.html#attr-fe-name">name</a></code>
1001: attribute represents the element's name. The <code title="attr-fe-disabled"><a href="association-of-controls-and-forms.html#attr-fe-disabled">disabled</a></code> attribute is used to make
1002: the control non-interactive and to prevent its value from being
1003: submitted. The <code title="attr-fe-autofocus"><a href="association-of-controls-and-forms.html#attr-fe-autofocus">autofocus</a></code>
1004: attribute controls focus.</p><dl class="domintro"><dt><var title="">keygen</var> . <code title="attr-keygen-type">type</code></dt>
1005:
1006: <dd>
1007:
1008: <p>Returns the string "<code title="">keygen</code>".</p>
1009:
1010: </dd>
1011:
1012: </dl><p class="note">This specification does not specify how the private
1013: key generated is to be used. It is expected that after receiving the
1.42 mike 1014: <code><a href="http://dev.w3.org/html5/spec/the-button-element.html#signedpublickeyandchallenge" class="full-spec-link" title='Read about this "SignedPublicKeyAndChallenge" reference in the full HTML5 spec.'>SignedPublicKeyAndChallenge</a></code> (SPKAC) structure, the
1.9 mike 1015: server will generate a client certificate and offer it back to the
1016: user for download; this certificate, once downloaded and stored in
1017: the key store along with the private key, can then be used to
1018: authenticate to services that use SSL and certificate
1019: authentication.</p><!-- how does the UA know which private key is associated with a
1020: certificate it gets back after the server has taken the public key
1021: created by <keygen> and turned it into a client cert? --><div class="example">
1022:
1023: <p>To generate a key pair, add the private key to the user's key
1024: store, and submit the public key to the server, markup such as the
1025: following can be used:</p>
1026:
1.22 mike 1027: <pre><form action="processkey.cgi" method="post" enctype="multipart/form-data">
1.9 mike 1028: <p><keygen name="key"></p>
1029: <p><input type=submit value="Submit key..."></p>
1030: </form></pre>
1031:
1032: <p>The server will then receive a form submission with a packaged
1033: RSA public key as the value of "<code title="">key</code>". This
1034: can then be used for various purposes, such as generating a client
1035: certificate, as mentioned above.</p>
1036:
1.30 mike 1037: </div><h4 id="the-output-element"><span class="secno">4.10.15 </span>The <dfn><code>output</code></dfn> element</h4><p class="XXX annotation"><b>Status: </b><i>Last call for comments</i></p><dl class="element"><dt>Categories</dt>
1.9 mike 1038: <dd><a href="content-models.html#flow-content">Flow content</a>.</dd>
1039: <dd><a href="content-models.html#phrasing-content">Phrasing content</a>.</dd>
1.11 mike 1040: <dd><a href="forms.html#category-listed" title="category-listed">Listed</a>, <a href="forms.html#category-label" title="category-label">labelable</a>, and <a href="forms.html#category-reset" title="category-reset">resettable</a> <a href="forms.html#form-associated-element">form-associated element</a>.</dd>
1.9 mike 1041: <dt>Contexts in which this element may be used:</dt>
1042: <dd>Where <a href="content-models.html#phrasing-content">phrasing content</a> is expected.</dd>
1043: <dt>Content model:</dt>
1044: <dd><a href="content-models.html#phrasing-content">Phrasing content</a>.</dd>
1045: <dt>Content attributes:</dt>
1046: <dd><a href="elements.html#global-attributes">Global attributes</a></dd>
1047: <dd><code title="attr-output-for"><a href="#attr-output-for">for</a></code></dd>
1048: <dd><code title="attr-fae-form"><a href="association-of-controls-and-forms.html#attr-fae-form">form</a></code></dd>
1049: <dd><code title="attr-fe-name"><a href="association-of-controls-and-forms.html#attr-fe-name">name</a></code></dd>
1050: <dt>DOM interface:</dt>
1051: <dd>
1052: <pre class="idl">interface <dfn id="htmloutputelement">HTMLOutputElement</dfn> : <a href="elements.html#htmlelement">HTMLElement</a> {
1.42 mike 1053: [PutForwards=<a href="http://dev.w3.org/html5/spec/common-dom-interfaces.html#dom-domsettabletokenlist-value" title='Read about this "value" reference in the full HTML5 spec.' class="full-spec-link">value</a>] readonly attribute <a href="urls.html#domsettabletokenlist">DOMSettableTokenList</a> <span title="dom-output-wrap">htmlFor</span>;
1054: readonly attribute <a href="forms.html#htmlformelement">HTMLFormElement</a> <a href="http://dev.w3.org/html5/spec/association-of-controls-and-forms.html#dom-fae-form" title='Read about this "form" reference in the full HTML5 spec.' class="full-spec-link">form</a>;
1055: attribute DOMString <a href="http://dev.w3.org/html5/spec/association-of-controls-and-forms.html#dom-fe-name" title='Read about this "name" reference in the full HTML5 spec.' class="full-spec-link">name</a>;
1056:
1057: readonly attribute DOMString <a href="http://dev.w3.org/html5/spec/the-button-element.html#dom-output-type" title='Read about this "type" reference in the full HTML5 spec.' class="full-spec-link">type</a>;
1058: attribute DOMString <a href="http://dev.w3.org/html5/spec/the-button-element.html#dom-output-defaultvalue" title='Read about this "defaultValue" reference in the full HTML5 spec.' class="full-spec-link">defaultValue</a>;
1059: attribute DOMString <a href="http://dev.w3.org/html5/spec/the-button-element.html#dom-output-value" title='Read about this "value" reference in the full HTML5 spec.' class="full-spec-link">value</a>;
1060:
1061: readonly attribute boolean <a href="http://dev.w3.org/html5/spec/association-of-controls-and-forms.html#dom-cva-willvalidate" title='Read about this "willValidate" reference in the full HTML5 spec.' class="full-spec-link">willValidate</a>;
1062: readonly attribute <a href="http://dev.w3.org/html5/spec/association-of-controls-and-forms.html#validitystate" class="full-spec-link" title='Read about this "ValidityState" reference in the full HTML5 spec.'>ValidityState</a> <a href="http://dev.w3.org/html5/spec/association-of-controls-and-forms.html#dom-cva-validity" title='Read about this "validity" reference in the full HTML5 spec.' class="full-spec-link">validity</a>;
1063: readonly attribute DOMString <a href="http://dev.w3.org/html5/spec/association-of-controls-and-forms.html#dom-cva-validationmessage" title='Read about this "validationMessage" reference in the full HTML5 spec.' class="full-spec-link">validationMessage</a>;
1064: boolean <a href="http://dev.w3.org/html5/spec/association-of-controls-and-forms.html#dom-cva-checkvalidatity" title='Read about this "checkValidity" reference in the full HTML5 spec.' class="full-spec-link">checkValidity</a>();
1065: void <a href="http://dev.w3.org/html5/spec/association-of-controls-and-forms.html#dom-cva-setcustomvalidity" title='Read about this "setCustomValidity" reference in the full HTML5 spec.' class="full-spec-link">setCustomValidity</a>(in DOMString error);
1.11 mike 1066:
1.42 mike 1067: readonly attribute <a href="http://dev.w3.org/html5/spec/infrastructure.html#nodelist" class="full-spec-link" title='Read about this "NodeList" reference in the full HTML5 spec.'>NodeList</a> <a href="http://dev.w3.org/html5/spec/forms.html#dom-lfe-labels" title='Read about this "labels" reference in the full HTML5 spec.' class="full-spec-link">labels</a>;
1.9 mike 1068: };</pre>
1069: </dd>
1.42 mike 1070: </dl><p>The <code><a href="#the-output-element">output</a></code> element <a href="http://dev.w3.org/html5/spec/rendering.html#represents" class="full-spec-link" title='Read about this "represents" reference in the full HTML5 spec.'>represents</a> the result of a
1.9 mike 1071: calculation.</p><p>The <dfn id="attr-output-for" title="attr-output-for"><code>for</code></dfn> content
1072: attribute allows an explicit relationship to be made between the
1073: result of a calculation and the elements that represent the values
1074: that went into the calculation or that otherwise influenced the
1075: calculation. The <code title="attr-output-for"><a href="#attr-output-for">for</a></code> attribute,
1076: if specified, must contain a string consisting of an <a href="common-microsyntaxes.html#unordered-set-of-unique-space-separated-tokens">unordered
1077: set of unique space-separated tokens</a>, each of which must have
1078: the value of an ID of an element in the same
1.42 mike 1079: <code><a href="http://dev.w3.org/html5/spec/infrastructure.html#document" class="full-spec-link" title='Read about this "Document" reference in the full HTML5 spec.'>Document</a></code>.</p><p>The <code title="attr-fae-form"><a href="association-of-controls-and-forms.html#attr-fae-form">form</a></code> attribute is used to
1.9 mike 1080: explicitly associate the <code><a href="#the-output-element">output</a></code> element with its
1081: <a href="association-of-controls-and-forms.html#form-owner">form owner</a>. The <code title="attr-fe-name"><a href="association-of-controls-and-forms.html#attr-fe-name">name</a></code>
1.42 mike 1082: attribute represents the element's name.</p><dl class="domintro"><dt><var title="">output</var> . <code title="dom-output-value"><a href="http://dev.w3.org/html5/spec/the-button-element.html#dom-output-value" class="full-spec-link" title='Read about this "value" reference in the full HTML5 spec.'>value</a></code> [ = <var title="">value</var> ]</dt>
1.9 mike 1083:
1084: <dd>
1085:
1086: <p>Returns the element's current value.</p>
1087:
1088: <p>Can be set, to change the value.</p>
1089:
1090: </dd>
1091:
1.42 mike 1092: <dt><var title="">output</var> . <code title="dom-output-defaultValue"><a href="http://dev.w3.org/html5/spec/the-button-element.html#dom-output-defaultvalue" class="full-spec-link" title='Read about this "defaultValue" reference in the full HTML5 spec.'>defaultValue</a></code> [ = <var title="">value</var> ]</dt>
1.9 mike 1093:
1094: <dd>
1095:
1096: <p>Returns the element's current default value.</p>
1097:
1098: <p>Can be set, to change the default value.</p>
1099:
1100: </dd>
1101:
1.42 mike 1102: <dt><var title="">output</var> . <code title="dom-output-type"><a href="http://dev.w3.org/html5/spec/the-button-element.html#dom-output-type" class="full-spec-link" title='Read about this "type" reference in the full HTML5 spec.'>type</a></code></dt>
1.9 mike 1103:
1104: <dd>
1105:
1106: <p>Returns the string "<code title="">output</code>".</p>
1107:
1108: </dd>
1109:
1110: </dl><div class="example">
1111:
1112: <p>A simple calculator could use <code><a href="#the-output-element">output</a></code> for its
1113: display of calculated results:</p>
1114:
1115: <pre><form onsubmit="return false">
1116: <input name=a type=number step=any> +
1117: <input name=b type=number step=any> =
1.32 mike 1118: <output onforminput="value = a.valueAsNumber + b.valueAsNumber"></output>
1.9 mike 1119: </form></pre>
1120:
1.30 mike 1121: </div><h4 id="the-progress-element"><span class="secno">4.10.16 </span>The <dfn><code>progress</code></dfn> element</h4><p class="XXX annotation"><b>Status: </b><i>Last call for comments. </i><span><a href="http://www.w3.org/html/wg/tracker/issues/96">ISSUE-96</a> (progress) blocks progress to Last Call</span></p><dl class="element"><dt>Categories</dt>
1.11 mike 1122: <dd><a href="content-models.html#flow-content">Flow content</a>.</dd>
1123: <dd><a href="content-models.html#phrasing-content">Phrasing content</a>.</dd>
1124: <dd><a href="forms.html#category-label" title="category-label">Labelable</a> <a href="forms.html#form-associated-element">form-associated element</a>.</dd>
1125: <dt>Contexts in which this element may be used:</dt>
1126: <dd>Where <a href="content-models.html#phrasing-content">phrasing content</a> is expected.</dd>
1127: <dt>Content model:</dt>
1128: <dd><a href="content-models.html#phrasing-content">Phrasing content</a>, but there must be no <code><a href="#the-progress-element">progress</a></code> element descendants.</dd>
1129: <dt>Content attributes:</dt>
1130: <dd><a href="elements.html#global-attributes">Global attributes</a></dd>
1131: <dd><code title="attr-progress-value"><a href="#attr-progress-value">value</a></code></dd>
1132: <dd><code title="attr-progress-max"><a href="#attr-progress-max">max</a></code></dd>
1133: <dd><code title="attr-fae-form"><a href="association-of-controls-and-forms.html#attr-fae-form">form</a></code></dd>
1134: <dt>DOM interface:</dt>
1135: <dd>
1136: <pre class="idl">interface <dfn id="htmlprogresselement">HTMLProgressElement</dfn> : <a href="elements.html#htmlelement">HTMLElement</a> {
1.42 mike 1137: attribute float <a href="http://dev.w3.org/html5/spec/the-button-element.html#dom-progress-value" title='Read about this "value" reference in the full HTML5 spec.' class="full-spec-link">value</a>;
1138: attribute float <a href="http://dev.w3.org/html5/spec/the-button-element.html#dom-progress-max" title='Read about this "max" reference in the full HTML5 spec.' class="full-spec-link">max</a>;
1139: readonly attribute float <a href="http://dev.w3.org/html5/spec/the-button-element.html#dom-progress-position" title='Read about this "position" reference in the full HTML5 spec.' class="full-spec-link">position</a>;
1140: readonly attribute <a href="forms.html#htmlformelement">HTMLFormElement</a> <a href="http://dev.w3.org/html5/spec/association-of-controls-and-forms.html#dom-fae-form" title='Read about this "form" reference in the full HTML5 spec.' class="full-spec-link">form</a>;
1141: readonly attribute <a href="http://dev.w3.org/html5/spec/infrastructure.html#nodelist" class="full-spec-link" title='Read about this "NodeList" reference in the full HTML5 spec.'>NodeList</a> <a href="http://dev.w3.org/html5/spec/forms.html#dom-lfe-labels" title='Read about this "labels" reference in the full HTML5 spec.' class="full-spec-link">labels</a>;
1.11 mike 1142: };</pre>
1143: </dd>
1.42 mike 1144: </dl><p>The <code><a href="#the-progress-element">progress</a></code> element <a href="http://dev.w3.org/html5/spec/rendering.html#represents" class="full-spec-link" title='Read about this "represents" reference in the full HTML5 spec.'>represents</a> the
1.11 mike 1145: completion progress of a task. The progress is either indeterminate,
1146: indicating that progress is being made but that it is not clear how
1147: much more work remains to be done before the task is complete
1148: (e.g. because the task is waiting for a remote host to respond), or
1149: the progress is a number in the range zero to a maximum, giving the
1150: fraction of work that has so far been completed.</p><p>There are two attributes that determine the current task
1151: completion represented by the element.</p><p>The <dfn id="attr-progress-value" title="attr-progress-value"><code>value</code></dfn>
1152: attribute specifies how much of the task has been completed, and the
1153: <dfn id="attr-progress-max" title="attr-progress-max"><code>max</code></dfn> attribute
1154: specifies how much work the task requires in total. The units are
1155: arbitrary and not specified.</p><p>Authors are encouraged to also include the current value and the
1156: maximum value inline as text inside the element, so that the
1157: progress is made available to users of legacy user agents.</p><div class="example">
1158: <p>Here is a snippet of a Web application that shows the progress
1159: of some automated task:</p>
1160: <pre><section>
1161: <h2>Task Progress</h2>
1162: <p>Progress: <progress id="p" max=100><span>0</span>%</progress></p>
1163: <script>
1164: var progressBar = document.getElementById('p');
1165: function updateProgress(newValue) {
1166: progressBar.value = newValue;
1167: progressBar.getElementsByTagName('span')[0].textContent = newValue;
1168: }
1169: </script>
1170: </section></pre>
1171: <p>(The <code>updateProgress()</code> method in this example would
1172: be called by some other code on the page to update the actual
1173: progress bar as the task progressed.)</p>
1174: </div><p>The <code title="attr-progress-value"><a href="#attr-progress-value">value</a></code> and <code title="attr-progress-max"><a href="#attr-progress-max">max</a></code> attributes, when present, must
1175: have values that are <a href="common-microsyntaxes.html#valid-floating-point-number" title="valid floating point number">valid
1176: floating point numbers</a>. The <code title="attr-progress-value"><a href="#attr-progress-value">value</a></code> attribute, if present, must
1177: have a value equal to or greater than zero, and less than or equal
1178: to the value of the <code title="attr-progress-max"><a href="#attr-progress-max">max</a></code>
1179: attribute, if present, or 1.0, otherwise. The <code title="attr-progress-max"><a href="#attr-progress-max">max</a></code> attribute, if present, must
1180: have a value greater than zero.</p><p class="note">The <code><a href="#the-progress-element">progress</a></code> element is the wrong
1181: element to use for something that is just a gauge, as opposed to
1182: task progress. For instance, indicating disk space usage using
1183: <code><a href="#the-progress-element">progress</a></code> would be inappropriate. Instead, the
1.42 mike 1184: <code><a href="#the-meter-element">meter</a></code> element is available for such use cases.</p><dl class="domintro"><dt><var title="">progress</var> . <code title="dom-progress-position"><a href="http://dev.w3.org/html5/spec/the-button-element.html#dom-progress-position" class="full-spec-link" title='Read about this "position" reference in the full HTML5 spec.'>position</a></code></dt>
1.11 mike 1185:
1186: <dd>
1187:
1188: <p>For a determinate progress bar (one with known current and
1189: maximum values), returns the result of dividing the current value
1190: by the maximum value.</p>
1191:
1.41 mike 1192: <p>For an indeterminate progress bar, returns −1.</p>
1.11 mike 1193:
1.30 mike 1194: </dd></dl><h4 id="the-meter-element"><span class="secno">4.10.17 </span>The <dfn><code>meter</code></dfn> element</h4><p class="XXX annotation"><b>Status: </b><i>Last call for comments. </i><span><a href="http://www.w3.org/html/wg/tracker/issues/97">ISSUE-97</a> (meter) blocks progress to Last Call</span></p><!-- Keep this after <progress> and NOT close to <time> --><dl class="element"><dt>Categories</dt>
1.11 mike 1195: <dd><a href="content-models.html#flow-content">Flow content</a>.</dd>
1196: <dd><a href="content-models.html#phrasing-content">Phrasing content</a>.</dd>
1197: <dd><a href="forms.html#category-label" title="category-label">Labelable</a> <a href="forms.html#form-associated-element">form-associated element</a>.</dd>
1198: <dt>Contexts in which this element may be used:</dt>
1199: <dd>Where <a href="content-models.html#phrasing-content">phrasing content</a> is expected.</dd>
1200: <dt>Content model:</dt>
1201: <dd><a href="content-models.html#phrasing-content">Phrasing content</a>, but there must be no <code><a href="#the-meter-element">meter</a></code> element descendants.</dd>
1202: <dt>Content attributes:</dt>
1203: <dd><a href="elements.html#global-attributes">Global attributes</a></dd>
1204: <dd><code title="attr-meter-value"><a href="#attr-meter-value">value</a></code></dd>
1205: <dd><code title="attr-meter-min"><a href="#attr-meter-min">min</a></code></dd>
1206: <dd><code title="attr-meter-max"><a href="#attr-meter-max">max</a></code></dd>
1207: <dd><code title="attr-meter-low"><a href="#attr-meter-low">low</a></code></dd>
1208: <dd><code title="attr-meter-high"><a href="#attr-meter-high">high</a></code></dd>
1209: <dd><code title="attr-meter-optimum"><a href="#attr-meter-optimum">optimum</a></code></dd>
1210: <dd><code title="attr-fae-form"><a href="association-of-controls-and-forms.html#attr-fae-form">form</a></code></dd>
1211: <dt>DOM interface:</dt>
1212: <dd>
1213: <pre class="idl">interface <dfn id="htmlmeterelement">HTMLMeterElement</dfn> : <a href="elements.html#htmlelement">HTMLElement</a> {
1.42 mike 1214: attribute float <a href="http://dev.w3.org/html5/spec/the-button-element.html#dom-meter-value" title='Read about this "value" reference in the full HTML5 spec.' class="full-spec-link">value</a>;
1215: attribute float <a href="http://dev.w3.org/html5/spec/the-button-element.html#dom-meter-min" title='Read about this "min" reference in the full HTML5 spec.' class="full-spec-link">min</a>;
1216: attribute float <a href="http://dev.w3.org/html5/spec/the-button-element.html#dom-meter-max" title='Read about this "max" reference in the full HTML5 spec.' class="full-spec-link">max</a>;
1217: attribute float <a href="http://dev.w3.org/html5/spec/the-button-element.html#dom-meter-low" title='Read about this "low" reference in the full HTML5 spec.' class="full-spec-link">low</a>;
1218: attribute float <a href="http://dev.w3.org/html5/spec/the-button-element.html#dom-meter-high" title='Read about this "high" reference in the full HTML5 spec.' class="full-spec-link">high</a>;
1219: attribute float <a href="http://dev.w3.org/html5/spec/the-button-element.html#dom-meter-optimum" title='Read about this "optimum" reference in the full HTML5 spec.' class="full-spec-link">optimum</a>;
1220: readonly attribute <a href="forms.html#htmlformelement">HTMLFormElement</a> <a href="http://dev.w3.org/html5/spec/association-of-controls-and-forms.html#dom-fae-form" title='Read about this "form" reference in the full HTML5 spec.' class="full-spec-link">form</a>;
1221: readonly attribute <a href="http://dev.w3.org/html5/spec/infrastructure.html#nodelist" class="full-spec-link" title='Read about this "NodeList" reference in the full HTML5 spec.'>NodeList</a> <a href="http://dev.w3.org/html5/spec/forms.html#dom-lfe-labels" title='Read about this "labels" reference in the full HTML5 spec.' class="full-spec-link">labels</a>;
1.11 mike 1222: };</pre>
1223: </dd>
1.42 mike 1224: </dl><p>The <code><a href="#the-meter-element">meter</a></code> element <a href="http://dev.w3.org/html5/spec/rendering.html#represents" class="full-spec-link" title='Read about this "represents" reference in the full HTML5 spec.'>represents</a> a scalar
1.11 mike 1225: measurement within a known range, or a fractional value; for example
1226: disk usage, the relevance of a query result, or the fraction of a
1227: voting population to have selected a particular candidate.</p><p>This is also known as a gauge.</p><p class="note">The <code><a href="#the-meter-element">meter</a></code> element should not be used to
1228: indicate progress (as in a progress bar). For that role, HTML
1229: provides a separate <code><a href="#the-progress-element">progress</a></code> element.</p><p class="note">The <code><a href="#the-meter-element">meter</a></code> element also does not
1.41 mike 1230: represent a scalar value of arbitrary range — for example, it
1.11 mike 1231: would be wrong to use this to report a weight, or height, unless
1232: there is a known maximum value.</p><p>There are six attributes that determine the semantics of the
1233: gauge represented by the element.</p><p>The <dfn id="attr-meter-min" title="attr-meter-min"><code>min</code></dfn> attribute
1234: specifies the lower bound of the range, and the <dfn id="attr-meter-max" title="attr-meter-max"><code>max</code></dfn> attribute specifies
1235: the upper bound. The <dfn id="attr-meter-value" title="attr-meter-value"><code>value</code></dfn> attribute
1236: specifies the value to have the gauge indicate as the "measured"
1237: value.</p><p>The other three attributes can be used to segment the gauge's
1238: range into "low", "medium", and "high" parts, and to indicate which
1239: part of the gauge is the "optimum" part. The <dfn id="attr-meter-low" title="attr-meter-low"><code>low</code></dfn> attribute specifies
1240: the range that is considered to be the "low" part, and the <dfn id="attr-meter-high" title="attr-meter-high"><code>high</code></dfn> attribute specifies
1241: the range that is considered to be the "high" part. The <dfn id="attr-meter-optimum" title="attr-meter-optimum"><code>optimum</code></dfn> attribute
1242: gives the position that is "optimum"; if that is higher than the
1243: "high" value then this indicates that the higher the value, the
1244: better; if it's lower than the "low" mark then it indicates that
1245: lower values are better, and naturally if it is in between then it
1.17 mike 1246: indicates that neither high nor low values are good.</p><p> The <code title="attr-meter-value"><a href="#attr-meter-value">value</a></code> attribute must be
1.11 mike 1247: specified. The <code title="attr-meter-value"><a href="#attr-meter-value">value</a></code>, <code title="attr-meter-min"><a href="#attr-meter-min">min</a></code>, <code title="attr-meter-low"><a href="#attr-meter-low">low</a></code>, <code title="attr-meter-high"><a href="#attr-meter-high">high</a></code>, <code title="attr-meter-max"><a href="#attr-meter-max">max</a></code>, and <code title="attr-meter-optimum"><a href="#attr-meter-optimum">optimum</a></code> attributes, when present,
1248: must have values that are <a href="common-microsyntaxes.html#valid-floating-point-number" title="valid floating point
1249: number">valid floating point numbers</a>.</p><p>In addition, the attributes' values are further constrained:</p><p>Let <var title="">value</var> be the <code title="attr-meter-value"><a href="#attr-meter-value">value</a></code> attribute's number.</p><p>If the <code title="attr-meter-min"><a href="#attr-meter-min">min</a></code> attribute
1250: attribute is specified, then let <var title="">minimum</var> be that
1251: attribute's value; otherwise, let it be zero.</p><p>If the <code title="attr-meter-max"><a href="#attr-meter-max">max</a></code> attribute
1252: attribute is specified, then let <var title="">maximum</var> be that
1.41 mike 1253: attribute's value; otherwise, let it be 1.0.</p><p>The following inequalities must hold, as applicable:</p><ul class="brief"><li><var title="">minimum</var> ≤ <var title="">value</var> ≤ <var title="">maximum</var></li>
1254: <li><var title="">minimum</var> ≤ <code title="attr-meter-low"><a href="#attr-meter-low">low</a></code> ≤ <var title="">maximum</var> (if <code title="attr-meter-low"><a href="#attr-meter-low">low</a></code> is specified)</li>
1255: <li><var title="">minimum</var> ≤ <code title="attr-meter-high"><a href="#attr-meter-high">high</a></code> ≤ <var title="">maximum</var> (if <code title="attr-meter-high"><a href="#attr-meter-high">high</a></code> is specified)</li>
1256: <li><var title="">minimum</var> ≤ <code title="attr-meter-optimum"><a href="#attr-meter-optimum">optimum</a></code> ≤ <var title="">maximum</var> (if <code title="attr-meter-optimum"><a href="#attr-meter-optimum">optimum</a></code> is specified)</li>
1257: <li><code title="attr-meter-low"><a href="#attr-meter-low">low</a></code> ≤ <code title="attr-meter-high"><a href="#attr-meter-high">high</a></code> (if both <code title="attr-meter-low"><a href="#attr-meter-low">low</a></code> and <code title="attr-meter-high"><a href="#attr-meter-high">high</a></code> are specified)</li>
1.21 mike 1258: </ul><p class="note">If no minimum or maximum is specified, then the
1.11 mike 1259: range is assumed to be 0..1, and the value thus has to be within
1260: that range.</p><p>Authors are encouraged to include a textual representation of the
1261: gauge's state in the element's contents, for users of user agents
1262: that do not support the <code><a href="#the-meter-element">meter</a></code> element.</p><div class="example">
1263:
1264: <p>The following examples show three gauges that would all be
1265: three-quarters full:</p>
1266:
1267: <pre>Storage space usage: <meter value=6 max=8>6 blocks used (out of 8 total)</meter>
1268: Voter turnout: <meter value=0.75><img alt="75%" src="graph75.png"></meter>
1269: Tickets sold: <meter min="0" max="100" value="75"></meter></pre>
1270:
1271: <p>The following example is incorrect use of the element, because
1272: it doesn't give a range (and since the default maximum is 1, both
1273: of the gauges would end up looking maxed out):</p>
1274:
1275: <pre class="bad"><p>The grapefruit pie had a radius of <meter value=12>12cm</meter>
1276: and a height of <meter value=2>2cm</meter>.</p> <!-- <strong>BAD!</strong> --></pre>
1277:
1278: <p>Instead, one would either not include the meter element, or use
1279: the meter element with a defined range to give the dimensions in
1280: context compared to other pies:</p>
1281:
1282: <pre><p>The grapefruit pie had a radius of 12cm and a height of
1283: 2cm.</p>
1284: <dl>
1285: <dt>Radius: <dd> <meter min=0 max=20 value=12>12cm</meter>
1286: <dt>Height: <dd> <meter min=0 max=10 value=2>2cm</meter>
1287: </dl></pre>
1288:
1289: </div><p>There is no explicit way to specify units in the
1290: <code><a href="#the-meter-element">meter</a></code> element, but the units may be specified in the
1291: <code title="attr-title"><a href="elements.html#the-title-attribute">title</a></code> attribute in free-form text.</p><div class="example">
1292:
1293: <p>The example above could be extended to mention the units:</p>
1294:
1295: <pre><dl>
1296: <dt>Radius: <dd> <meter min=0 max=20 value=12 title="centimeters">12cm</meter>
1297: <dt>Height: <dd> <meter min=0 max=10 value=2 title="centimeters">2cm</meter>
1298: </dl></pre>
1299:
1300: </div><div class="example">
1301: <p>The following markup:</p>
1302: <pre><h3>Suggested groups</h3>
1303: <menu type="toolbar">
1304: <a href="?cmd=hsg" onclick="hideSuggestedGroups()">Hide suggested groups</a>
1305: </menu>
1306: <ul>
1307: <li>
1308: <p><a href="/group/comp.infosystems.www.authoring.stylesheets/view">comp.infosystems.www.authoring.stylesheets</a> -
1309: <a href="/group/comp.infosystems.www.authoring.stylesheets/subscribe">join</a></p>
1310: <p>Group description: <strong>Layout/presentation on the WWW.</strong></p>
1311: <p><strong><meter value="0.5">Moderate activity,</meter></strong> Usenet, 618 subscribers</p>
1312: </li>
1313: <li>
1314: <p><a href="/group/netscape.public.mozilla.xpinstall/view">netscape.public.mozilla.xpinstall</a> -
1315: <a href="/group/netscape.public.mozilla.xpinstall/subscribe">join</a></p>
1316: <p>Group description: <strong>Mozilla XPInstall discussion.</strong></p>
1317: <p><strong><meter value="0.25">Low activity,</meter></strong> Usenet, 22 subscribers</p>
1318: </li>
1319: <li>
1320: <p><a href="/group/mozilla.dev.general/view">mozilla.dev.general</a> -
1321: <a href="/group/mozilla.dev.general/subscribe">join</a></p>
1322: <p><strong><meter value="0.25">Low activity,</meter></strong> Usenet, 66 subscribers</p>
1323: </li>
1324: </ul></pre>
1325: <p>Might be rendered as follows:</p>
1326: <p><img alt="With the <meter> elements rendered as inline green bars of varying lengths." src="http://dev.w3.org/html5/spec/images/sample-meter.png"></p>
1.13 mike 1327: </div><p>User agents combine the value of
1328: the <code title="attr-title"><a href="elements.html#the-title-attribute">title</a></code> attribute and the other
1.11 mike 1329: attributes to provide context-sensitive help or inline text
1330: detailing the actual values.</p><div class="example">
1331: <p>For example, the following snippet:</p>
1332: <pre><meter min=0 max=60 value=23.2 title=seconds></meter></pre>
1333: <p>...might cause the user agent to display a gauge with a tooltip
1334: saying "Value: 23.2 out of 60." on one line and "seconds" on a
1335: second line.</p>
1336: </div><p>The <code title="attr-fae-form"><a href="association-of-controls-and-forms.html#attr-fae-form">form</a></code> attribute is used to
1337: explicitly associate the <code><a href="#the-meter-element">meter</a></code> element with its
1.27 mike 1338: <a href="association-of-controls-and-forms.html#form-owner">form owner</a>.</p><div class="example">
1.11 mike 1339:
1340: <p>The following example shows how a gauge could fall back to
1341: localized or pretty-printed text.</p>
1342:
1.41 mike 1343: <pre><p>Disk usage: <meter min=0 value=170261928 max=233257824>170 261 928 bytes used
1344: out of 233 257 824 bytes available</meter></p></pre>
1.11 mike 1345:
1.9 mike 1346: </div></body></html>
Webmaster