javascript弹出窗口帮助

时间:2011-04-07 03:29:24

标签: javascript

这就是我想要完成的......我从原​​始文档中创建了一个弹出窗口。这是代码..

<script type="text/javascript">
        function subscribe() {
            window.open("cover.htm", "popWin", "width=125, height=240, left=10, screenX=10, top=10, screenY=10");
        }
   </script>

我在窗口加载时调用了该函数。现在,在弹出窗口中,我想点击一个链接,该链接将在原始窗口中打开另一个htm文件。我知道我必须使用opener关键字,但不知道该怎么做。

任何建议都将不胜感激..

2 个答案:

答案 0 :(得分:1)

对于您要做的事情,这似乎是a great article

答案 1 :(得分:0)

您可以在父页面上设置功能以更改位置,然后使用window.opener进行访问。

父页面

function changeParentURL(url) {
    document.location=url;
}

儿童页面

window.opener.changeParentURL('http://new.htm');