Change the location of the first <iframe> element (index 0) in the current window:
More "Try it Yourself" examples below.
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.
Property | |||||
---|---|---|---|---|---|
frames | Yes | Yes | Yes | Yes | Yes |
Return Value: | Returns a reference to the Window object, representing all frames in the current window |
---|
Loop through all frames on a page, and change the location of all frames to "w3schools.com":
HTML reference: HTML <iframe> tag