HTML DOM -vormvoorwerp
Vorm Voorwerp
Die Form-objek verteenwoordig 'n HTML <form>-element.
Toegang tot 'n vormobjek
Jy kan toegang tot 'n <form>-element kry deur getElementById():
Voorbeeld
var x = document.getElementById("myForm");
Wenk: Jy kan ook toegang tot 'n <form>-element kry deur die vormversameling te gebruik .
Skep 'n vormvoorwerp
Jy kan 'n <form> element skep deur die document.createElement() metode te gebruik:
Voorbeeld
var x = document.createElement("FORM");
Vorm voorwerpversamelings
Collection | Description |
---|---|
elements | Returns a collection of all elements in a form |
Vorm Object Properties
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 |
Vorm-objekmetodes
Method | Description |
---|---|
reset() | Resets a form |
submit() | Submits a form |
Standaard eiendomme en geleenthede
Die Vorm-objek ondersteun ook die standaard eienskappe en gebeurtenisse .
Verwante bladsye
HTML-tutoriaal: HTML-vorms
JavaScript-tutoriaal: JS-vorms/validering
HTML verwysing: HTML <form> tag