window.frameElement
Summary
Returns the element (such as <iframe> or <object> ) in which the window is embedded, or null if the window is top-level.
Syntax
var frameEl = window.frameElement;
frameElis the element which the window is embedded into, ornullif the window is top-level.
Example
var frameEl = window.frameElement;
// if we are inside a frame, then change it's URL to 'http://mozilla.org/'
if (frameEl)
frameEl.src = 'http://mozilla.org/';
Notes
Note that despite its name, the property also works for documents inside <object> and other embedding points.
See also
window.framesreturns an array-like object, listing the direct sub-frames of the current window.window.parentreturns the parent window, which is the window containing theframeElementof the child window.
Specification
DOM Level 0. Not part of any standard.
此属性返回当前窗口所在的框架元素,如<iframe> 或 <object>,若为顶级窗口则返回 null。可用于检查并操作当前页面的嵌套状态。

1021

被折叠的 条评论
为什么被折叠?



