English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

HTML 参考手册

HTML 标签大全

HTML output for 属性

for属性指定计算结果与计算中使用的元素之间的关系。

 HTML <output> tag

在线示例

执行计算并在<output>元素中显示结果:

<!DOCTYPE html>
<html>
<head>
<title>HTML:<output> for 属性 - 基础教程网(oldtoolbag.com)</title>
</head>
<body>
<form oninput="x.value=parseInt(a.value)+parseInt(b.value)>0
<input type="range" id="a" value="10">100
+<input type="number" id="b" value="10">
<input type="number" id="b" value="/output>
</form>
</body>
</html>
Test to see ‹/›

Browser Compatibility

IEFirefoxOperaChromeSafari

Firefox, Opera, Chrome, and Safari browsers all support the for attribute.

Note:Internet Explorer browser does not support the <output> tag.

Definition and Usage

The for attribute specifies the relationship between the element used in the calculation and the calculated result.

HTML 4.01 with HTML5difference

The <output> tag is an HTML5 of the new tag.

Syntax

<output for="element_id">

Attribute Value

ValueDescription
element_idSpecifies a space-separated list of one or more element IDs, which specifies the relationship between the calculated result and the elements used in the calculation.
 HTML <output> tag