X
HOME HTML5 CSS3 JAVASCRIPT SQL PHP5 JQUERY ANGULAR BOOTSTRAP3 XML MORE...
REFERENCES | EXAMPLES | FORUM | ABOUT

Window frames Property

Window Object Reference Window Object

Example

Change the location of the first <iframe> element (index 0) in the current window:

window.frames[0].location = "http://www.w3schools.com/jsref";

Try it yourself »

More "Try it Yourself" examples below.


Definition and Usage

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

The <iframe> elements can be accessed by index numbers. The index starts at 0.

Tip: Use frames.length to find the number of frames.

Note: This property will also work for <frame> elements. However, the <frame> element is not supported HTML5.

This property is read-only.


Browser Support

Property
frames Yes Yes Yes Yes Yes


Syntax

window.frames

Technical Details

Return Value: Returns a reference to the Window object, representing all frames in the current window


Examples

More Examples

Example

Loop through all frames on a page, and change the location of all frames to "w3schools.com":

var frames = window.frames;
var i;

for (i = 0; i < frames.length; i++) {
    frames[i].location = "http://www.w3schools.com";
}

Try it yourself »


Related Pages

HTML reference: HTML <iframe> tag


Window Object Reference Window Object

Your suggestion:

Close [X]

Thank You For Helping Us!

Your message has been sent to W3Schools.

Close [X]
Search w3schools.com:

WEB HOSTING

UK Reseller Hosting

WEB BUILDING

Download XML Editor FREE Website BUILDER Free HTML5 Templates

SHARE THIS PAGE

facebook