aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/api/window/top
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/top
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/top')
-rw-r--r--files/zh-cn/web/api/window/top/index.html55
1 files changed, 55 insertions, 0 deletions
diff --git a/files/zh-cn/web/api/window/top/index.html b/files/zh-cn/web/api/window/top/index.html
new file mode 100644
index 0000000000..d2142ec21e
--- /dev/null
+++ b/files/zh-cn/web/api/window/top/index.html
@@ -0,0 +1,55 @@
+---
+title: Window.top
+slug: Web/API/Window/top
+tags:
+ - API
+ - HTML DOM
+ - Property
+ - Reference
+ - Window
+translation_of: Web/API/Window/top
+---
+<p>{{APIRef}}</p>
+
+<p>返回窗口层级最顶层窗口的引用。</p>
+
+<h2 id="语法" name="语法">语法</h2>
+
+<pre class="eval">var <em>topWindow</em> = window.top;
+</pre>
+
+<h2 id="备注" name="备注"><span style="font-family: Arial,Arial,Helvetica,sans-serif; line-height: 20px;">备注</span></h2>
+
+<p> <code style="font-style: normal; line-height: 1.5;"><a href="https://developer.mozilla.org/zh-CN/DOM/window.parent" title="en/DOM/window.parent">window.parent</a></code> <span style="line-height: 1.5;">返回当前窗口的直接父对象,而 </span>{{domxref("window.top")}}<span style="line-height: 1.5;"> </span><span style="font-family: 'Courier New','Andale Mono',monospace; line-height: inherit;">返回最顶层的窗口对象。</span></p>
+
+<p> </p>
+
+<p>当你在处理父窗口的子框架(subframe),而你想获取顶层框架时,这个属性相当有用。</p>
+
+<h2 id="规范" name="规范" style="line-height: 24px;">规范</h2>
+
+<table>
+ <thead>
+ <tr>
+ <th scope="col">Specification</th>
+ <th scope="col">Status</th>
+ <th scope="col">Comment</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td>{{SpecName('HTML WHATWG', 'browsers.html#dom-top', 'window.top')}}</td>
+ <td>{{Spec2('HTML WHATWG')}}</td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td>{{SpecName('HTML5 W3C', 'browsers.html#dom-top', 'window.top')}}</td>
+ <td>{{Spec2('HTML5 W3C')}}</td>
+ <td>Initial definition</td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="浏览器兼容性" name="浏览器兼容性">浏览器兼容性</h2>
+
+<p>{{Compat("api.Window.top")}}</p>