length Property

Gets or sets the number of objects in a collection.

Syntax

HTML N/A
Scripting [ iLength = ] object.length

Possible Values

iLength Integer that specifies or receives the number of objects.

The property is read/write for all objects except the following, for which it is read-only: COMMENT, pages. The property has no default value.

Remarks

The window.length property returns the number of frames contained in a window.

The comment.length property returns the number of characters in the object.

Although this property is read-only for most of the objects listed in the Applies To section, it is read/write for the areas collection (image maps), the options collection (select boxes), and the select object. In all other cases, this property has read-only permission, which means you can retrieve, but cannot change, its current value.

The form.length property does not count input type=image elements. To access all elements contained in a form, use the children collection.

For Windows CE only, this collection will always be empty.

As of Windows Internet Explorer 8, this property is read-only in the areas collection.

In Microsoft Internet Explorer 6 and later, this property applies to the comment object.

Standards Information

This property is defined in Document Object Model (DOM) Level 1.

Applies To

all, anchors, applets, areas, attributes, behaviorUrns, bookmarks, boundElements, cells, childNodes, children, COMMENT, controlRange, elements, embeds, filters, forms, frames, images, imports, links, namespaces, options, pages, plugins, rows, rules, scripts, SELECT, styleSheets, tBodies, TextRectangle, TextRange, window, FORM, documentCompatibleInfoCollection, HTMLCommentElement Constructor, HTMLFormElement Constructor, HTMLSelectElement Constructor, BehaviorUrnsCollection Constructor, BookmarkCollection Constructor, CompatibleInfoCollection Constructor, ControlRangeCollection Constructor, HTMLAreasCollection Constructor, HTMLCollection Constructor, HTMLNamespaceInfoCollection Constructor, HTMLPluginsCollection Constructor, StyleSheetList Constructor, StyleSheetPageList Constructor, TextRangeCollection Constructor, TextRectangleList Constructor, Window Constructor