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