Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

Window length property

Window length property

Window Object Reference Window Object


Definition and Usage

The length property returns the number of frames in the current window (including IFRAMES).

Syntax

window.length


Browser support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the length property.


Example

Example

Find the number of frames on the page and change the src attribute of each frame element to "www.runoob.com":

<html>
<body>
<iframe src="http://www.microsoft.com" iframe>
<iframe src="http://www.google.com" iframe>
<iframe src="http://www.youtube.com" iframe>
<script>

for (var i=0; i

<

frames

.

length

;

i

++) {

frames

[

i

].

location

=

"

http://www.runoob.com

"

}

script

body

html


Window Object Reference Window Object