From 33058f2b292b3a581333bdfb21b8f671898c5060 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:40:17 -0500 Subject: initial commit --- files/zh-cn/web/api/window/top/index.html | 55 +++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 files/zh-cn/web/api/window/top/index.html (limited to 'files/zh-cn/web/api/window/top') 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 +--- +

{{APIRef}}

+ +

返回窗口层级最顶层窗口的引用。

+ +

语法

+ +
var topWindow = window.top;
+
+ +

备注

+ +

 window.parent 返回当前窗口的直接父对象,而 {{domxref("window.top")}} 返回最顶层的窗口对象。

+ +

 

+ +

当你在处理父窗口的子框架(subframe),而你想获取顶层框架时,这个属性相当有用。

+ +

规范

+ + + + + + + + + + + + + + + + + + + + + +
SpecificationStatusComment
{{SpecName('HTML WHATWG', 'browsers.html#dom-top', 'window.top')}}{{Spec2('HTML WHATWG')}} 
{{SpecName('HTML5 W3C', 'browsers.html#dom-top', 'window.top')}}{{Spec2('HTML5 W3C')}}Initial definition
+ +

浏览器兼容性

+ +

{{Compat("api.Window.top")}}

-- cgit v1.2.3-54-g00ecf