HTML <出力>タグ


計算を実行し、結果を<output>要素に表示します。

<form oninput="x.value=parseInt(a.value)+parseInt(b.value)">
  <input type="range" id="a" value="50">
  +<input type="number" id="b" value="25">
  =<output name="x" for="a b"></output>
</form>

定義と使用法

タグは、計算の<output>結果を表すために使用されます(スクリプトによって実行されるようなもの)。


ブラウザのサポート

表の数字は、要素を完全にサポートする最初のブラウザバージョンを示しています。

Element
<output> 10.0 13.0  4.0 5.1 11.0

属性

Attribute Value Description
for element_id Specifies the relationship between the result of the calculation, and the elements used in the calculation
form form_id Specifies which form the output element belongs to
name name Specifies a name for the output element


グローバル属性

この<output>タグは、HTMLのグローバル属性もサポートしています。


イベント属性

この<output>タグは、HTMLのイベント属性もサポートしています。


関連ページ

HTML DOMリファレンス:出力オブジェクト


デフォルトのCSS設定

ほとんどのブラウザは<output>、次のデフォルト値で要素を表示します。

output {
  display: inline;
}