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