Window frames property
- Previous page frameElement
- Next page history
- Go up one level Window Object
Definition and usage
frames
The property returns an array containing all the window objects in the window.
frames
The properties are read-only.
These windows can be accessed by index number. The first index is 0.
Tip:Frames can be any embedded element:<frame>, <iframe>, <embed>, <object> etc.
See also:
Instance
Example 1
Change the location of the first frame:
window.frames[0].location = "https://www.codew3c.com/jsref/";
Example 2
Loop through all frames and change the color:
const frames = window.frames; for (let i = 0; i < frames.length; i++) { frames[i].document.body.style.background = "red"; }
Syntax
window.frames
Return value
Type | Description |
---|---|
Array | All window objects in the window. |
Browser support
All browsers support window.frames
:
Chrome | IE | Edge | Firefox | Safari | Opera |
---|---|---|---|---|---|
Chrome | IE | Edge | Firefox | Safari | Opera |
Support | Support | Support | Support | Support | Support |
- Previous page frameElement
- Next page history
- Go up one level Window Object