form | NN 2 IE 3 DOM 1
The form object reflects the form element. The form object can be referenced in all scriptable browsers via the value assigned to its tag name attribute or by the index of the forms array contained by every document. For browsers that support the id attribute (IE 4 and later and Netscape 6), you may also use the element object reference formats that employ the element's ID. To assemble a reference to a nested form control object (such as input and textarea element objects), you have a choice again of using backward compatible references that include the form object as part of the reference (as in document.formName.controlName); or in more modern browsers, you can reference the control element directly via its unique ID.
HTML Equivalent
    <form>
Object Model Reference
    [window.]document.formName
    [window.]document.forms[i]
    [window.]document.form["formName"]
    [window.]document.getElementById("elementID")
Object-Specific Properties
acceptCharset | action | elements[ ] | encoding | enctype
length | method | name | target |
Object-Specific Methods
handleEvent( ) | reset( ) | submit( )
Object-Specific Event Handler Properties
Events | IE Windows | IE Mac | NN | W3C DOM
onreset | 3 | 3.01 | 3 | 2
onsubmit | 3 | 3.01 | 3 | 2

acceptCharset | NN 6 IE 5 DOM 1
| Read/Write
A server advisory (for servers that are equipped to interpret the information) about which character sets it must receive from a client form.
Example
    document.entryForm.acceptCharset= "it, es";
Value
Case-insensitive string from the character set registry (ftp://ftp.isi.edu/in-notes/iana/assignments/character-sets). Multiple character sets may be delimited by commas.
Default
Empty string, except in IE/Windows, with a default of UNKNOWN.

action | NN 2 IE 3 DOM 1
| Read/Write
Provides the URL to be accessed when a form is being submitted. Script control of this property lets one form be submitted to different server processes based on user interaction with the rest of the form. This property is read-only in IE 3.
Example
    document.entryForm.action = "http://www.megacorp.com/cgi-bin/altEntry";
Value
Complete or relative URL.
Default
None.

elements[ ] | NN 2 IE 3 DOM 1
| Read-only
Returns an array of all form control objects contained by the current form.
Example
    for (var i = 0; i < document.entryForm.elements.length; i++) {
        if (document.entryForm.elements[i].type == "text") {
            document.entryForm.elements[i].value = "";
        }
    }
Value
Array of element object references.
Default
Array of length zero.

encoding | NN 2 IE 3 DOM n/a
| Read/Write
Specifies the MIME type for the data being submitted to the server with the form. For typical form submissions (where the method attribute is set to post), the default value is the proper content type. But if you change the action property for a form by script, consider whether you require a custom encoding for the purpose. This property is read-only in IE 3. See also the encType property.
Example
    document.orderForm.encoding = "text/plain";
Value
Case-insensitive MIME type (content type) value as a string. For multiple items, a comma-delimited list is allowed in a single string.
Default
"application/x-www-form-urlencoded" in IE; empty string in Netscape 6.

enctype | NN 6 IE 5(Mac)/6(Win) DOM 1
| Read/Write
Provides the W3C DOM property name for what had been the encoding property of earlier DOM implementations. Current browsers support both property names. See the encoding property.
Example
    document.orderForm.enctype = "text/plain";
Value
Case-insensitive MIME type (content type) value as a string. For multiple items, a comma-delimited list is allowed in a single string.
Default
"application/x-www-form-urlencoded"; empty string in Netscape 6.

length | NN 2 IE 3 DOM 1
| Read-only
Specifies the number of form control elements in the form. You can use this property in lieu of the length of the form's elements array.
Example
    for (var i = 0; i < document.forms[0].length; i++)
        ...
    }
Value
Integer.
Default
0

method | NN 2 IE 3 DOM 1
| Read/Write
Forms may be submitted via two possible HTTP methods: get and post. These methods determine whether the form element data is sent to the server appended to the action attribute URL (get) or as a transaction message body (post). In practice, when the action and method attributes are not assigned in a form element, the form performs an unconditional reload of the same document, restoring form controls to their default values. Note that the method property is read-only in Internet Explorer 3.
Example
    document.entryForm.method = "post";
Value
Either of the following constant values as a string: get | post.
Default
get

name | NN 2 IE 3 DOM 1
| Read/Write
This is the identifier associated with the form. This information is not submitted with the form, but a form's name is used in references to the form and nested form elements. Despite the modern standards' preference for the id attribute, many browsers still require that a form be assigned a name attribute to allow the form to be submitted.
Example
    var firstFormName = document.forms[0].name;
Value
Case-sensitive identifier that follows the rules of identifier naming: it may contain no whitespace, cannot begin with a numeral, and should avoid punctuation except for the underscore character.
Default
None.

target | NN 2 IE 3 DOM 1
| Read/Write
The name of the window or frame that is to receive content returned by the server after the form is submitted. Such names are assigned to frames by the frame element's name attribute; for subwindows, the name is assigned via the second parameter of the window.open( ) method. Because the corresponding target attribute is not recognized by strict HTML or XHTML validators, you can omit the attribute to survive validation, yet still direct form results to another window by assigning a value to the form's target property in script.
Example
    document.getElementById("myForm").target = "_blank";
Value
String value of the window or frame name, or any of the following constants (as a string): _parent | _self | _top | _blank. The _parent value targets the frameset to which the current document belongs; the _self value targets the current window; the _top value targets the main browser window, thereby eliminating all frames; and the _blank value (or any unused identifier, for that matter) creates a new window of default size.
Default
None (which implies the current window or frame).

handleEvent( ) | NN |4| IE n/a DOM n/a
handleEvent(event) |
Instructs the object to accept and process the event whose specifications are passed as the parameter to the method. The object must have an event handler for the event type to process the event.
Parameters
A Navigator 4 event object.
Returned Value
None.

reset( ) | NN 3 IE 4 DOM 1
Performs the same action as a click of a reset-type input element. All form controls revert to their default values.
Parameters
None.
Returned Value
None.

submit( ) | NN 2 IE 3 DOM 1
Performs the same action as a click of a submit-type input element. This method does not fire the onSubmit event handler in Navigator or recent versions of IE.
Parameters
None.
Returned Value
None.