aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/api/window/frames/index.html
diff options
context:
space:
mode:
Diffstat (limited to 'files/zh-cn/web/api/window/frames/index.html')
-rw-r--r--files/zh-cn/web/api/window/frames/index.html56
1 files changed, 56 insertions, 0 deletions
diff --git a/files/zh-cn/web/api/window/frames/index.html b/files/zh-cn/web/api/window/frames/index.html
new file mode 100644
index 0000000000..2d3331b096
--- /dev/null
+++ b/files/zh-cn/web/api/window/frames/index.html
@@ -0,0 +1,56 @@
+---
+title: Window.frames
+slug: Web/API/Window/frames
+translation_of: Web/API/Window/frames
+---
+<p>{{ApiRef("Window")}}</p>
+
+<h2 id="Summary" name="Summary">概要</h2>
+
+<p>返回当前窗口,一个类数组对象,列出了当前窗口的所有直接子窗口。</p>
+
+<h2 id="Syntax" name="Syntax">语法</h2>
+
+<pre class="eval"><em>frameList</em> = window.frames;
+</pre>
+
+<ul>
+ <li>frameList是一个frame对象的集合,它类似一个数组,有length属性且可以使用索引([i])来访问。</li>
+ <li><code>frameList === window</code> 计算结果为true。</li>
+ <li>在window.frames类数组中的每一项都代表了窗口对应给定对象的&lt;frame&gt;或&lt;iframe&gt;的内容,而不是(i)frame DOM元素(即window.frames[ 0 ]与document.getElementsByTagName( "iframe" )[ 0 ].contentWindow是相同的)。</li>
+ <li>有关返回值的更多详细信息,请参考 <a class="external" href="http://groups.google.com/group/mozilla.dev.platform/browse_thread/thread/5628c6f346859d4f/169aa7004565066?hl=en&amp;ie=UTF-8&amp;oe=utf-8&amp;q=window.frames&amp;pli=1" title="http://groups.google.com/group/mozilla.dev.platform/browse_thread/thread/5628c6f346859d4f/169aa7004565066?hl=en&amp;ie=UTF-8&amp;oe=utf-8&amp;q=window.frames&amp;pli=1">thread on mozilla.dev.platform</a> 。</li>
+</ul>
+
+<h2 id="Example" name="Example">实例</h2>
+
+<pre class="brush: js">var frames = window.frames; // 或 // var frames = window.parent.frames;
+for (var i = 0; i &lt; frames.length; i++) {
+ // 在这对frames的一个frame做点什么
+ frames[i].document.body.style.background = "red";
+
+}
+</pre>
+
+<h2 id="Specification" name="Specification">规范</h2>
+
+<p>{{ DOM0() }}</p>
+
+<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>