HTML Output element
(
<output>
) is a container element into which a site or app can inject the results of a calculation or the outcome of a user action.
| 内容类别 | 流内容 , 措词内容 , listed , labelable , resettable form-associated element ,可触及内容。 |
|---|---|
| 准许内容 | 措词内容 . |
| Tag omission | None, both the starting and ending tag are mandatory. |
| Permitted parents | Any element that accepts 措词内容 . |
| Implicit ARIA role |
status
|
| Permitted ARIA roles | 任何 |
| DOM 接口 |
HTMLOutputElement
|
此元素包括 全局属性 .
for
id
s, indicating that those elements contributed input values to (or otherwise affected) the calculation.
form
<form>
element to associate the output with (its
form owner
). The value of this attribute must be the
id
的
<form>
in the same document. (If this attribute is not set, the
<output>
is associated with its ancestor
<form>
element, if any.)
<output>
elements to
<form>
s anywhere in the document, not just inside a
<form>
. It can also override an ancestor
<form>
元素。
名称
form.elements
API。
<output>
value, name, and contents are NOT submitted during form submission.
In the following example, the form provides a slider whose value can range between
0
and
100
, and an
<input>
element into which you can enter a second number. The two numbers are added together, and the result is displayed in the
<output>
element each time the value of any of the controls changes.
<form oninput="result.value=parseInt(a.value)+parseInt(b.value)"> <input type="range" id="b" name="b" value="50" /> + <input type="number" id="a" name="a" value="10" /> = <output name="result" for="a b">60</output> </form>
Many browsers implement this element as an
aria-live
region. Assistive technology will thereby announce the results of UI interactions posted inside it without requiring that focus is switched away from the controls that produce those results.
| 规范 | 状态 | 注释 |
|---|---|---|
|
HTML 实时标准
The definition of '<output>' in that specification. |
实时标准 | |
|
HTML5
The definition of '<output>' in that specification. |
推荐 |
| 桌面 | 移动 | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
output
|
Chrome 完整支持 10 | Edge 完整支持 ≤18 | Firefox 完整支持 4 | IE 不支持 No | Opera 完整支持 11 | Safari 完整支持 7 | WebView Android 完整支持 Yes | Chrome Android 完整支持 Yes | Firefox Android 完整支持 4 | Opera Android ? | Safari iOS 完整支持 Yes | Samsung Internet Android 完整支持 Yes |
for
|
Chrome 完整支持 10 | Edge 完整支持 ≤18 | Firefox 完整支持 4 | IE 不支持 No | Opera 完整支持 11 | Safari 完整支持 7 | WebView Android 完整支持 Yes | Chrome Android 完整支持 Yes | Firefox Android 完整支持 4 | Opera Android ? | Safari iOS 完整支持 Yes | Samsung Internet Android 完整支持 Yes |
完整支持
不支持
兼容性未知
<button>
<datalist>
<fieldset>
<form>
<input>
<label>
<legend>
<meter>
<optgroup>
<option>
<output>
<progress>
<select>
<textarea>