aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/api/window/frameelement
diff options
context:
space:
mode:
authorPeter Bengtsson <mail@peterbe.com>2020-12-08 14:40:17 -0500
committerPeter Bengtsson <mail@peterbe.com>2020-12-08 14:40:17 -0500
commit33058f2b292b3a581333bdfb21b8f671898c5060 (patch)
tree51c3e392513ec574331b2d3f85c394445ea803c6 /files/zh-cn/web/api/window/frameelement
parent8b66d724f7caf0157093fb09cfec8fbd0c6ad50a (diff)
downloadtranslated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.gz
translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.bz2
translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.zip
initial commit
Diffstat (limited to 'files/zh-cn/web/api/window/frameelement')
-rw-r--r--files/zh-cn/web/api/window/frameelement/index.html73
1 files changed, 73 insertions, 0 deletions
diff --git a/files/zh-cn/web/api/window/frameelement/index.html b/files/zh-cn/web/api/window/frameelement/index.html
new file mode 100644
index 0000000000..12c587d725
--- /dev/null
+++ b/files/zh-cn/web/api/window/frameelement/index.html
@@ -0,0 +1,73 @@
+---
+title: window.frameElement
+slug: Web/API/Window/frameElement
+translation_of: Web/API/Window/frameElement
+---
+<p>{{ ApiRef() }}</p>
+<h3 id="Summary" name="Summary">概述</h3>
+<p>返回嵌入当前<code>window</code>对象的元素(比如 <code>&lt;iframe&gt;</code> 或者 <code>&lt;object&gt;</code>),如果当前<code>window</code>对象已经是顶层窗口,则返回<code>null</code>.</p>
+<h3 id="Syntax" name="Syntax">语法</h3>
+<pre class="eval">var <em>frameEl</em> = window.frameElement;
+</pre>
+<h3 id="Example" name="Example">例子</h3>
+<pre class="eval">var frameEl = window.frameElement;
+// 如果当前窗口被包含在一个框架里面,则将该框架的地址跳到'<span class="nowiki">http://mozilla.org/</span>'
+if (frameEl)
+ frameEl.src = '<span class="nowiki">http://mozilla.org/</span>';
+</pre>
+<h3 id="Notes" name="Notes">备注</h3>
+<p>虽然该属性名为<code>frameElement</code>,但该属性也会返回其他类型比如 <code>&lt;object&gt;</code> 或者其他可嵌入窗口的元素.</p>
+<h3 id="See_also" name="See_also">相关链接</h3>
+<ul>
+ <li><code><a href="/zh-cn/DOM/window.frames" title="zh-cn/DOM/window.frames">window.frames</a></code> 返回一个类数组对象,返回当前窗口的所有子框架元素.</li>
+ <li><code><a href="/zh-cn/DOM/window.parent" title="zh-cn/DOM/window.parent">window.parent</a></code> 返回当前窗口的父窗口,也就是说,包含当前窗口所在的<code>frameElement</code>元素的窗口.</li>
+</ul>
+<h3 id="Specification" name="Specification">规范</h3>
+<p><a class="external" href="http://www.whatwg.org/specs/web-apps/current-work/#dom-frameelement" title="http://www.whatwg.org/specs/web-apps/current-work/#dom-frameelement">WHATWG</a></p>
+<h3 id="浏览器兼容性">浏览器兼容性</h3>
+<p>{{ CompatibilityTable() }}</p>
+<div id="compat-desktop">
+ <table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Feature</th>
+ <th>Chrome</th>
+ <th>Firefox (Gecko)</th>
+ <th>Internet Explorer</th>
+ <th>Opera</th>
+ <th>Safari</th>
+ </tr>
+ <tr>
+ <td>Basic support</td>
+ <td>18</td>
+ <td>{{ CompatGeckoDesktop("1") }}</td>
+ <td>5.5?</td>
+ <td>{{ CompatUnknown() }}</td>
+ <td>{{ CompatUnknown() }}</td>
+ </tr>
+ </tbody>
+ </table>
+</div>
+<div id="compat-mobile">
+ <table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Feature</th>
+ <th>Android</th>
+ <th>Firefox Mobile (Gecko)</th>
+ <th>IE Mobile</th>
+ <th>Opera Mobile</th>
+ <th>Safari Mobile</th>
+ </tr>
+ <tr>
+ <td>Basic support</td>
+ <td>{{ CompatUnknown() }}</td>
+ <td>{{ CompatGeckoDesktop("1") }}</td>
+ <td>{{ CompatUnknown() }}</td>
+ <td>{{ CompatUnknown() }}</td>
+ <td>{{ CompatUnknown() }}</td>
+ </tr>
+ </tbody>
+ </table>
+</div>
+<p>{{ languages( { "ja": "ja/DOM/window.frameElement", "pl": "pl/DOM/window.frameElement", "en": "en/DOM/window.frameElement" } ) }}</p>