HTML DOM FormObject
Form Object
The Form object represents an HTML form.
A Form object is created for each <form> that appears in an HTML document.
Forms are typically used to collect user data, and contain input elements such as text fields, checkboxes, radio buttons, and submit buttons. Forms can also include option menus, textarea, fieldset, legend, and label elements.
Forms are used to send data to the server.
Form Object Collection
W3C:W3C standard.
| Collection | Description | W3C |
|---|---|---|
| elements[] | An array containing all the elements in the form. | Yes |
Form Object Properties
| Property | Description | W3C |
|---|---|---|
| acceptCharset | The character set that the server can accept. | Yes |
| action | Sets or returns the action attribute of a form. | Yes |
| enctype | Sets or returns the MIME type used by the form to encode content. | Yes |
| length | Returns the number of elements in the form. | Yes |
| method | Sets or returns the HTTP method used to send data to the server. | Yes |
| name | Sets or returns the name of the form. | Yes |
| target | Sets or returns the name of the Frame or Window where the form results are displayed. | Yes |
Form Object Methods
| Method | Description | W3C |
|---|---|---|
| reset() | Resets a form | Yes |
| submit() | Submits a form | Yes |
Form Object Events
| Event | Description | W3C |
|---|---|---|
| onreset | Called before the form elements are reset. | Yes |
| onsubmit | Called before the form is submitted. | Yes |
Standard Properties and Events
Form objects also support standardPropertiesandEvents。
Other Extensions