自强学堂
自强学堂:学习、分享、让你更强!
JavaScript 参考手册HTMLCSSJAVASCRIPTJQUERYSQLPHPBOOTSTRAPANGULARXML
 

Window parent 属性

Window 对象参考手册 Window 对象

定义和用法

parent属性返回当前窗口的父窗口。

语法

window.parent


浏览器支持

Internet ExplorerFirefoxOperaGoogle ChromeSafari

所有主要浏览器都支持 parent 属性


实例

实例

当打开新窗口时,在父窗口弹出警告:

<html>
<head>
<script>
function openWin()
{
window.open('','','width=200,height=100');
alert(window.parent.location);
}
</script>
</head>
<body>

<input type="button" value="Open window" onclick="openWin()">

</body>
</html>

尝试一下 »


Window 对象参考手册 Window 对象