diff options
author | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:40:17 -0500 |
---|---|---|
committer | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:40:17 -0500 |
commit | 33058f2b292b3a581333bdfb21b8f671898c5060 (patch) | |
tree | 51c3e392513ec574331b2d3f85c394445ea803c6 /files/zh-cn/web/api/window/parent/index.html | |
parent | 8b66d724f7caf0157093fb09cfec8fbd0c6ad50a (diff) | |
download | translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.gz translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.bz2 translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.zip |
initial commit
Diffstat (limited to 'files/zh-cn/web/api/window/parent/index.html')
-rw-r--r-- | files/zh-cn/web/api/window/parent/index.html | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/files/zh-cn/web/api/window/parent/index.html b/files/zh-cn/web/api/window/parent/index.html new file mode 100644 index 0000000000..58c756ee2e --- /dev/null +++ b/files/zh-cn/web/api/window/parent/index.html @@ -0,0 +1,39 @@ +--- +title: window.parent +slug: Web/API/Window/parent +translation_of: Web/API/Window/parent +--- +<p>{{ ApiRef() }}</p> + +<h3 id="Summary" name="Summary">概述</h3> + +<p>返回当前窗口的父窗口对象.</p> + +<p>如果一个窗口没有父窗口,则它的 <code>parent</code> 属性为自身的引用.</p> + +<p>如果当前窗口是一个 <code><iframe></code>, <code><object></code>, 或者 <code><frame></code>,则它的父窗口是嵌入它的那个窗口</p> + +<h3 id="Syntax" name="Syntax">语法</h3> + +<pre class="eval">var <em>parentWindow</em> = window.parent; +</pre> + +<h3 id="Example" name="Example">例子</h3> + +<pre class="eval">if (window.parent != window.top) { + // 至少有三层窗口 +} +</pre> + +<h3 id="See_also" name="See_also">相关链接</h3> + +<ul> + <li><code><a href="/zh-cn/DOM/window.frameElement" title="zh-cn/DOM/window.frameElement">window.frameElement</a></code> 返回嵌入当前窗口的frame对象.</li> + <li><code><a href="/zh-CN/docs/Web/API/Window/top" title="zh-cn/DOM/window.top">window.top</a></code> 返回当前窗口最顶层的父窗口.</li> +</ul> + +<h3 id="Specification" name="Specification">规范</h3> + +<p>{{ DOM0() }}</p> + +<p>{{ languages( { "fr": "fr/DOM/window.parent", "ja": "ja/DOM/window.parent" , "en": "en/DOM/window.parent"} ) }}</p> |