วัตถุรีเซ็ตอินพุต HTML DOM
อินพุตรีเซ็ตวัตถุ
ออบเจ็กต์ Input Reset แสดงถึงองค์ประกอบ <input> HTML ที่มี type="reset"
เข้าถึงวัตถุรีเซ็ตอินพุต
คุณสามารถเข้าถึง <input> องค์ประกอบด้วย type="reset" โดยใช้ getElementById():
ตัวอย่าง
var x = document.getElementById("myReset");
เคล็ดลับ:คุณยังสามารถเข้าถึง <input type="reset"> โดยการค้นหาผ่าน คอลเลคชัน องค์ประกอบของฟอร์ม
สร้างวัตถุรีเซ็ตอินพุต
คุณสามารถสร้าง <input> องค์ประกอบด้วย type="reset" โดยใช้ document.createElement() วิธีการ:
ตัวอย่าง
var x = document.createElement("INPUT");
x.setAttribute("type", "reset");
อินพุตรีเซ็ตคุณสมบัติของอ็อบเจ็กต์
Property | Description |
---|---|
autofocus | Sets or returns whether a reset button should automatically get focus when the page loads |
defaultValue | Sets or returns the default value of a reset button |
disabled | Sets or returns whether the reset button is disabled, or not |
form | Returns a reference to the form that contains the reset button |
name | Sets or returns the value of the name attribute of a reset button |
type | Returns which type of form element the reset button is |
value | Sets or returns the value of the value attribute of the reset button |
คุณสมบัติและเหตุการณ์มาตรฐาน
ออบเจ็กต์การรีเซ็ตอินพุตยังสนับสนุนคุณสมบัติและเหตุการณ์ มาตรฐาน อีกด้วย
หน้าที่เกี่ยวข้อง
กวดวิชา HTML: แบบฟอร์ม HTML
อ้างอิง HTML: HTML <input> tag
อ้างอิง HTML: HTML <input> ประเภทแอตทริบิวต์