length property
Sets or retrieves the number of objects in a collection.
Syntax
| JavaScript | |
|---|
Property values
Type: Integer
the number of objects.
Standards information
- Document Object Model (DOM) Level 1 Specification, Section 2.5.5
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 length property does not count input type=image elements. To access all elements contained in a form, call QueryInterface on IHTMLFormElement and request an IHTMLElement interface. Use the children property of the IHTMLElement interface to retrieve a collection of all elements in the form.
The form.length property does not count input type=image elements. To access all elements contained in a form, use the children collection.
This property is read-write on the areas collection for image maps and the options collection for select boxes. This allows a developer to shrink the 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.
See also
- all
- anchors
- applets
- areas
- attributes
- behaviorUrns
- bookmarks
- boundElements
- cells
- childNodes
- children
- comment
- controlRange
- documentCompatibleInfoCollection
- elements
- embeds
- filters
- form
- forms
- frames
- images
- imports
- links
- namespaces
- options
- pages
- rows
- rules
- scripts
- select
- styleSheets
- tBodies
- TextRange
- TextRectangle
- window