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