DHTML Object Properties DHTML Objects
Sets or retrieves the number of objects in a collection.
HTML |
N/A |
Script |
object.length [ = iLength ] |
iLength |
Integer value representing the number of objects. |
The property is read/write with no default value.
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.
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
areas, options