asp.net.ph

Skip Navigation Links

length Property

DHTML Object Properties   DHTML Objects


Sets or retrieves the number of objects in a collection.

Syntax

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

Possible Values

iLength Integer value representing the number of objects.

The property is read/write with no default value.

Remarks

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

This property is read/write on the areas collection ( image maps ), the options collection ( select boxes ), and the SELECT object.

In all other cases, this property has read-only permission, meaning you can retrieve its current value but not change it.

Example

This example code fragment retrieves the number of objects in the current document using the all collection, assigns that to a variable named howMany, and displays it in a message box.

howMany = document.all.length;
alert ( "This document has " + howMany + " objects." ) 

 Show me 

See Also

areas, options


Need a break ?
Suggested Reading

Check out related books at Amazon

© 2025 Reynald Nuñez and asp.net.ph.

If you have any question, comment or suggestion,
please send us a note