English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
parentA read-only property that returns the parent window of the current window.
If the window does not have a parent window, its parent property is a reference to itself.
When a window is loaded into an <iframe>, <object>, or <frame>, its parent window is the window that contains the element embedding the window.
window.parent
parent.document.body.style.backgroundColor = "coral";Test See‹/›
All browsers fully support the parent property:
Property | |||||
parent | Yes | Yes | Yes | Yes | Yes |
Return Value: | The parent window object of the current window |
---|
Display the position of the parent window when a new window is opened:
window.open("", "", "width=300, height=200"); document.getElementById("output").innerHTML = window.parent.location;Test See‹/›
Window (Window) Reference:window.frameElement Property
Window (Window) Reference:window.self Property
Window (Window) Reference:window.top Property
Tag Reference:HTML <embed> Tag
Tag Reference:HTML <object> Tag
Tag Reference:HTML <iframe> Tag