<output>
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since October 2018.
HTML <output>
标签表示计算或用户操作的结果。
Content categories | 流式元素,短语元素,listed, labelable, resettable form-associated element, palpable content. |
---|---|
允许元素 | 短语元素 |
标签省略 | 不允许,开始标签和结束标签都不能省略。 |
允许父元素 | 接受任何 短语元素 |
允许 ARIA 角色 | Any |
DOM 接口 | HTMLOutputElement |
属性
例子
html
<form oninput="result.value=parseInt(a.value)+parseInt(b.value)">
<input type="range" name="b" value="50" /> +
<input type="number" name="a" value="10" /> =
<output name="result"></output>
</form>
规范
Specification |
---|
HTML Standard # the-output-element |
浏览器兼容性
BCD tables only load in the browser
参见
- Other form-related elements:
<form>
,<input>
,<button>
,<datalist>
,<legend>
,<label>
,<select>
,<optgroup>
,<option>
,<textarea>
,<fieldset>
,<progress>
and<meter>
.