JavaScript窗口对象中的Opener属性

JavaScript Opener属性指定调用文档的窗口。
它返回创建窗口的窗口的引用。

Opener 属性的语法

window.opener
如何在JavaScript中使用窗口对象opener属性

Opener Property的示例

<!DOCTYPE html>

<html>

<head>

<script type="text/javascript">

    function OpenWindow() {

        myWindow = window.open('', '', 'width=200,height=100');

        myWindow.document.write("<p>这是 'MyWindow'窗口</p>");

        myWindow.focus();

        myWindow.opener.document.write("<p>它是源窗口。</p>");

    }

</script>

</head>

<body>

<input type="button" value="Open 'MyWindow'" onclick="OpenWindow()" 

</body>

</html>
日期:2020-04-11 23:04:38 来源:oir作者:oir