blob: 30ddd04b059a20ace8379bb87427d2b8a27f8c71 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
---
title: Window.frames
slug: Web/API/Window/frames
translation_of: Web/API/Window/frames
---
<p>{{APIRef("DOM")}}</p>
<p>Возвращает само окно, являющееся объектом в виде массива, распечатывая элементы текущего окна.</p>
<h2 id="Syntax">Syntax</h2>
<pre class="eval"><em>frameList</em> = window.frames;
</pre>
<ul>
<li><code>frameList</code> is a list of frame objects. It is similar to an array in that it has a <code>length</code> property and its items can be accessed using the <code>[i]</code> notation.</li>
<li><code>frameList === window</code> evaluates to true.</li>
<li>Each item in the window.frames pseudo-array represents the <a class="internal" href="/en/DOM/window" title="en/DOM/window">window</a> object corresponding to the given <a class="internal" href="/en/HTML/Element/frame" title="en/HTML/Element/frame"><frame></a>'s or <a class="internal" href="/en/HTML/Element/iframe" title="en/HTML/Element/iframe"><iframe></a>'s content, not the (i)frame DOM element (i.e., <code>window.frames[0]</code> is the same thing as <code>document.getElementsByTagName("iframe")[0].contentWindow</code>).</li>
<li>For more details about the returned value, refer to this <a class="external" href="http://groups.google.com/group/mozilla.dev.platform/browse_thread/thread/5628c6f346859d4f/169aa7004565066?hl=en&ie=UTF-8&oe=utf-8&q=window.frames&pli=1" title="http://groups.google.com/group/mozilla.dev.platform/browse_thread/thread/5628c6f346859d4f/169aa7004565066?hl=en&ie=UTF-8&oe=utf-8&q=window.frames&pli=1">thread on mozilla.dev.platform</a> [dead link].</li>
</ul>
<h2 id="Example">Example</h2>
<pre class="brush: js">var frames = window.frames; // or // var frames = window.parent.frames;
for (var i = 0; i < frames.length; i++) {
// do something with each subframe as frames[i]
frames[i].document.body.style.background = "red";
}
</pre>
<h2 id="Specifications">Specifications</h2>
<table class="spectable standard-table">
<tbody>
<tr>
<th scope="col">Specification</th>
<th scope="col">Status</th>
<th scope="col">Comment</th>
</tr>
<tr>
<td>{{SpecName("HTML WHATWG", "browsers.html#dom-frames", "Window.frames")}}</td>
<td>{{Spec2("HTML WHATWG")}}</td>
<td> </td>
</tr>
<tr>
<td>{{SpecName("HTML5 W3C", "browsers.html#dom-frames", "Window.frames")}}</td>
<td>{{Spec2("HTML5 W3C")}}</td>
<td> </td>
</tr>
</tbody>
</table>
<h2 id="Browser_compatibility">Browser compatibility</h2>
<p>{{Compat}}</p>
|