|acceptCharset||Gets or sets a list of character sets that are supported by the
|action||Gets or sets the value of the action
attribute of the form element.
|autocomplete||Gets or sets whether input elements
can have their values automatically completed by the browser.
|encoding||Tells the browser how to encode the form data (either as text
or as a file). This property is synonymous with enctype.
|enctype||Tells the browser how to encode the form data (either as text
or as a file).
|length||Gets the number of controls in the form.|
|method||Gets or sets the HTTP method the browser uses to submit the
|name||Gets or sets the name of the form.|
|noValidate||Indicates that the form does not need to be validated upon
|target||Indicates the place to display the results of a submitted
After referencing the form using one of these methods, you then access the property using dot notation or the square bracket method.
To get the value of the name property of the first form in a document, you could use the following statement:
A more common way to access a form is by assigning it an id attribute and using getElementById to select it.
The DOM provides another, more convenient method for accessing forms: the forms collection. The forms collection lets you access the forms in a document in two different ways:
By index number: When a form element is created in the document, it is assigned an index number, starting with zero. To access the first form in the document, use document.forms.
By name: You can also access forms using the value of the name attribute of the form element. For example, to get the value of the action property of a form with a name of “subscribeForm”, you would use document.forms.subscribeForm.action. Or you can use the square brackets method of accessing properties and write document.forms[“subscribeForm”].action.