Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

HTML DOM forms collection

HTML DOM forms collection

Document Object Reference Document Object


Definition and Usage

The forms collection returns an array collection of all forms on the current page.

Syntax

document.forms[]

.property


Browser support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the forms collection


Example

Example 1

Returns the number of forms in the document:

Number of forms:

The example above produces the following output:

Number of forms: 3

Try it »

Example 2

Returns the name of the first form in the document:

Name of the first form:

The example above produces the following output:

Name of the first form: Form1

Try it »


Document Object Reference Document Object