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