HTML DOM 양식 개체
양식 개체
Form 객체는 HTML <form> 요소를 나타냅니다.
양식 개체에 액세스
getElementById()를 사용하여 <form> 요소에 액세스할 수 있습니다.
예시
var x = document.getElementById("myForm");
팁: 양식 컬렉션 을 사용하여 <form> 요소에 액세스할 수도 있습니다 .
양식 개체 만들기
document.createElement() 메서드를 사용하여 <form> 요소를 만들 수 있습니다.
예시
var x = document.createElement("FORM");
양식 개체 컬렉션
Collection | Description |
---|---|
elements | Returns a collection of all elements in a form |
양식 개체 속성
Property | Description |
---|---|
acceptCharset | Sets or returns the value of the accept-charset attribute in a form |
action | Sets or returns the value of the action attribute in a form |
autocomplete | Sets or returns the value of the autocomplete attribute in a form |
encoding | Alias of enctype |
enctype | Sets or returns the value of the enctype attribute in a form |
length | Returns the number of elements in a form |
method | Sets or returns the value of the method attribute in a form |
name | Sets or returns the value of the name attribute in a form |
noValidate | Sets or returns whether the form-data should be validated or not, on submission |
target | Sets or returns the value of the target attribute in a form |
양식 개체 메서드
Method | Description |
---|---|
reset() | Resets a form |
submit() | Submits a form |
표준 속성 및 이벤트
Form 객체는 표준 속성 과 이벤트 도 지원합니다 .
관련 페이지
HTML 튜토리얼: HTML 양식
JavaScript 튜토리얼: JS Forms/Validation
HTML 참조: HTML <form> 태그