length Property

calendar November 20, 2009

Value: integer

Compatibility: WinIE3+, MacIE3+, Moz1+, Sasfari1+

The length property returns the number of items in an array or collection of objects. While arrays and collections use integer values as index values (starting with zero), the length value is the actual number of items in the group.

for(var i = 0; i < myArray.length; i++)
{
...
}

All browsers: document.forms.length

All browsers: document.forms[0].elements.length

Moz, IE4+: document.images.length

Moz: document.layers.length

IE4+: document.all.length

IE5+, W3C: document.getElementById(”myID”).childNodes.length

Related items: area, select and Array objects.

admin

Leave a Reply

You must be logged in to post a comment.