【发布时间】:2018-11-09 17:56:36
【问题描述】:
在父窗口中,我有一个打开(弹出)子窗口(包含 mp3 播放器,播放示例音频剪辑)的 onclick 事件。
子窗口打开时:
<a href="#" onclick="popupwindow('popup.html', 'mp3Player',800,300 ); return false;">Mp3 Clips</a>
我假设(错误地;)我可以通过以下方式返回父母:
<a href="#" onclick="window.opener();">return to win</a>
我如何返回到父窗口(以及让子窗口保持打开状态)。
在父窗口中的javascript函数是:
function popupwindow(url, winName, w, h) {
var left = (screen.width/2)-(w/2);
var top = (screen.height/2)-(h/2);
return window.open(url, winName, 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=yes, copyhistory=no, width='+w+', height='+h+', top='+top+', left='+left);
}
【问题讨论】:
-
什么是“返回父母”?
-
我有一个显示在浏览器“窗口”中的 html 页面,它包含一个打开弹出窗口(通常称为“子”窗口)的链接。因此,原始窗口通常被称为它的“父窗口”
-
我有 19 年的 Javascript 经验,所以我什么都知道,但是“return to parent”是什么意思?
-
我想显示原始窗口。即重点关注
标签: javascript html onclick