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>
ยังสนับสนุน Global Attributes ในHTML
คุณสมบัติของเหตุการณ์
แท็ ก<output>
ยังสนับสนุนแอตทริบิวต์เหตุการณ์ใน HTML
หน้าที่เกี่ยวข้อง
การอ้างอิง HTML DOM: วัตถุเอาต์พุต
การตั้งค่า CSS เริ่มต้น
เบราว์เซอร์ส่วนใหญ่จะแสดง<output>
องค์ประกอบด้วยค่าเริ่มต้นดังต่อไปนี้:
output {
display: inline;
}