document.forms.length

JavaScript 1.0+, JScript 1.0+ Nav2+, IE 3+, Opera3+ Syntax

document.forms.length

Description

The length property contains the number of Form objects that are in the forms[] array.

Example

Listing 7.100 uses the length property to display the number of Form objects in the document.

Listing 7.100 Access the Number of Forms in the Document with the length Property
 <html> <form name="Form1"> <input type="button" value="Green" onClick = "document.bgColor='green'"> </form> <form name="Form2"> <input type="button" value="Blue" onClick = "document.bgColor='blue'"> </form> <script language="JavaScript"> <!-- Hide //How many items in forms[] array? document.write(document.forms.length," Form objects in document."); //Hide ...

Get Pure JavaScript now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.