JavaScript Kit > JavaScript Reference > Here
Form Object
Last updated: June 20th, 2004
Forms on the page are represented in JavaScript via the form object, and can be accessed in one of the 3 standard ways below:
document.yourformname //where yourformname is the name of
your form.
document.form.yourformname
document.forms["yourformname"]
Related Tutorials
Events
| Events | Description |
|---|---|
| onReset | Code is executed when the form is reset (by clicking on "reset" button) |
| onSubmit | Code is executed when form is submitted. |
Properties
| Properties | Description |
|---|---|
| action | Read/write string that reflects the action attribute of the form. |
| elements[] | An array containing all of the elements of the form. Use it to loop through form easily. |
| encoding | Read/write string that specifies how the form data is encoded. |
| length | The number of elements in the form. |
| method | Read/write string that specifies how the method the form is submitted. |
| name | The name of the form. |
| target | The name of the target frame or window form is to be submitted to. |
Methods
| Methods | Description |
|---|---|
| reset() | Resets the form. |
| submit() | Submits a form. Example(s). |
Examples
submit()
<a href="javascript:document.myform.submit()"><img src="submit.gif" /></a>
Reference List
- JavaScript Operators
- JavaScript Statements
- Global functions
- JavaScript Events
- Escape Sequences
- Reserved Words
- Ajax (XMLHttpRequest)
- Anchor
- Applet
- Area
- Array
- Boolean
- Date
- Document
- Event
- Form
- Reset
- Frame
- Function
- History
- Image
- JSON object
- Link
- Location
- Math
- Navigator
- Number
- Object
- RegExp
- Screen
- String
- Style
- window
Partners
Right column
