You are here: Reference > JavaScript > client-side > HTML DOM > properties > length (window)

length property (window)

Browser support:
Returns the number of frames (frame or iframe) in the current window.
The frame elements can be accessed through the frames collection.


You can find the related objects in the Supported by objects section below.
This property is read/write.

Possible values:

Integer that represents the number of frames.
Default: this property has no default value.

Example HTML code 1:

This example illustrates the use of the length property:
    <script type="text/javascript">
        function GetNrOfFrames () {
            alert (window.length);
    <button onclick="GetNrOfFrames ()">Get the number of frames in the window!</button>
Did you find this example helpful? yes no

Supported by objects:

Related pages:

External links:

User Contributed Comments

Post Content

Post Content