Window frames Property - Javascript Browser Object Model

Javascript examples for Browser Object Model:Window frames


The frames property returns an array-like object for all <iframe> elements in the current window.

This property is read-only.

Return Value

The following code shows how to returns a reference to the Window object, representing all frames in the current window. It changes the location of the first <iframe> element (index 0) in the current window:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>

<button onclick="myFunction()">Test</button>

<iframe src=""></iframe>
<iframe src=""></iframe>
<iframe src=""></iframe>

function myFunction() {//from w ww.j av  a2 s .  c  o  m
    var frames = window.frames;
    var i;

    for (i = 0; i < frames.length; i++) {
        frames[i].location = "";


Related Tutorials