サーチ…
パラメーター
| 属性 | 説明 | 
|---|---|
| グローバル | 任意のHTML5要素で使用可能な属性。これらの属性の包括的なドキュメントについては、 MDNグローバル属性を参照してください。 | 
| 名 | 出力の名前を表す文字列。フォーム要素として、 document.formsプロパティを使用して、その名前で出力を参照できます。この属性は、フォーム送信時に値を収集するためにも使用されます。  | 
| にとって | フォーム要素のIDのスペースで区切られたリスト(例: <inputs id="inp1"> for value is "inp1" )は、出力が計算を表示することを意味します。  | 
| 形 | 出力に関連付けられた<form>を表す文字列。出力は外に実際にある場合は<form> 、この属性は、出力はまだに属していることを保証します<form>と言ったのコレクションや提出を受け<form> 。  | 
ForとForm属性を使用した出力要素
次のデモでは、 <output>要素の[for] [form]属性と[form]属性の使用について[form]ます。 <output> は機能するためにJavaScriptが必要であることに注意してください。この例で示すように、インラインJavaScriptはフォームでよく使用されます。 <input>要素はtype="number" 、そのvalueは数字ではなく、テキストです。したがって、 value sを計算する必要がある場合は、 parseInt() 、 parseFloat() 、 Number()などのメソッドを使用して、各valueに変換する必要がありparseInt() 。 
    <!--form1 will collect the values of in1 and in2 on 'input' event.-->
    <!--out1 value will be the sum of in1 and in2 values.-->    
<form id="form1" name="form1" oninput="out1.value = parseInt(in1.value, 10) + parseInt(in2.value, 10)">
  <fieldset>
    <legend>Output Example</legend>
      <input type="number" id="in1" name="in1" value="0">
    <br/>
    +
    <input type="number" id="in2" name="in2" value="0">
  </fieldset>
</form>
<!--[for] attribute enables out1 to display calculations for in1 and in2.-->
<!--[form] attribute designates form1 as the form owner of out1 even if it isn't a descendant.-->
<output name="out1" for="in1 in2" form="form1">0</output>
        属性を持つ出力要素
<output name="out1" form="form1" for="inp1 inp2"></output>
    
    
    
    
    Modified text is an extract of the original Stack Overflow Documentation
        ライセンスを受けた CC BY-SA 3.0
        所属していない Stack Overflow