Window frames property
- Previous Page frameElement
- Next Page history
- Go Up One Level Window Object
Definition and usage
frames
Property returns an array containing all window objects in the window.
frames
Properties are read-only.
These windows can be accessed by index. 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