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

HTML 参考手册

HTML 标签大全

HTML output form 属性

form 属性规定 <output> 元素所属的一个或多个表单。

 HTML <output> Tag

在线示例

位于表单外部(但仍是表单的一部分)的<output>元素:

<!DOCTYPE html>
<html>
<head>
<title>HTML:<output> form 属性 - 基础教程网(oldtoolbag.com)</title>
</head>
<body>
<form action="action_page.php" id="numform" oninput="x.value=parseInt(a.value)+parseInt(b.value)>0
<input type="range" id="a" name="a" value="30">100
+<input type="number" id="b" name="b" value="30">
<br><br>
<input type="submit">
</form>
<p>The output element below is outside the form, but is still part of the form.</p>
<output form="numform" name="x" for="a b"></output>
</body>
</html>
Test see ‹/›

Browser Compatibility

IEFirefoxOperaChromeSafari

Almost all mainstream browsers do not support the form attribute.

Definition and Usage

The form attribute specifies one or more forms to which the <output> element belongs.

HTML 4.01 and HTML5differences between

The <output> tag is an HTML5 new tag in.

Syntax

<output form="form_id">

Attribute Value

ValueDescription
form_idSpecify the form element to which the <output> element belongs. The value of this attribute must be the id attribute of a <form> element in the same document.
 HTML <output> Tag