Đối tượng gửi đầu vào HTML DOM
Nhập đối tượng gửi
Đối tượng Gửi đầu vào đại diện cho một phần tử HTML <input> với type = "submit".
Truy cập một đối tượng gửi đầu vào
Bạn có thể truy cập phần tử <input> với type = "submit" bằng cách sử dụng getElementById ():
Thí dụ
var x = document.getElementById("mySubmit");
Mẹo: Bạn cũng có thể truy cập <input type = "submit"> bằng cách tìm kiếm trong bộ sưu tập các phần tử của một biểu mẫu.
Tạo đối tượng gửi đầu vào
Bạn có thể tạo phần tử <input> với type = "submit" bằng cách sử dụng phương thức document.createElement ():
Thí dụ
var x = document.createElement("INPUT");
x.setAttribute("type", "submit");
Nhập thuộc tính đối tượng gửi
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 |
Thuộc tính và sự kiện tiêu chuẩn
Đối tượng Gửi đầu vào cũng hỗ trợ các thuộc tính và sự kiện tiêu chuẩn .
Các trang liên quan
Hướng dẫn HTML: Biểu mẫu HTML
Tham chiếu HTML: Thẻ HTML <input>
Tham chiếu HTML: Thuộc tính loại HTML <input>