Window: frames-Eigenschaft
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.
Gibt das Fenster selbst zurück, das ein array-ähnliches Objekt ist und die direkten Unter-Frames des aktuellen Fensters auflistet.
Wert
Eine Liste von Frame-Objekten. Es ist ähnlich wie ein Array, da es eine length
-Eigenschaft hat und seine Elemente mit der [i]
-Notation aufgerufen werden können.
frames === window
ergibt true.- Jedes Element im
window.frames
Pseudo-Array repräsentiert dasWindow
Objekt, das dem Inhalt des angegebenen<frame>
oder<iframe>
entspricht, nicht dasframe
oderiframe
DOM-Element (d.h.,window.frames[0]
ist dasselbe wiedocument.getElementsByTagName("iframe")[0].contentWindow
). - Für weitere Details über den zurückgegebenen Wert lesen Sie diesen Thread auf mozilla.dev.platform.
Beispiele
js
const frames = window.frames; // or const frames = window.parent.frames;
for (let i = 0; i < frames.length; i++) {
// do something with each subframe as frames[i]
frames[i].document.body.style.background = "red";
}
Spezifikationen
Specification |
---|
HTML # dom-frames-dev |
Browser-Kompatibilität
Report problems with this compatibility data on GitHubdesktop | mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
frames |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.