Window frames property
Window Object
Example
Modify the first
window
.
frames
[
0
]
.
location
=
"
https://www.runoob.com/
"
;
Try it »
Definition and Usage
The frames property returns all named frames in the window.
The collection is an array of Window objects, each Window object contains a frame or
Tip: Use frames.length to get the number of frames.
**Note:** This attribute can also be used for element, but HTML5 not supported element.
This attribute is read-only.
Browser Support
| Attribute | |||||
|---|---|---|---|---|---|
| frames | Yes | Yes | Yes | Yes | Yes |
Syntax
window.frames
Technical Details
| Return value: | Returns a reference to a Window object representing all frames in the current window. |
|---|
More Examples
Example
Find the number of all frames in the page, then change the src attribute of the iframe element to "https://www.runoob.com":
var
frames
=
window
.
frames
;
var
i
;
for
(
i
=
0
;
i
<
frames
.
length
;
i
++
)
{
frames
[
i
]
.
location
=
"
https://www.runoob.com
"
;
}
Try it »
Window Object