Firefox 插件:无法在 document.popup 中打开新页面

发布于 2024-09-17 22:38:53 字数 884 浏览 16 评论 0原文

我有一个 Firefox 插件,可以打开 document.popup 窗口。当我单击弹出窗口中的链接时,我想调用一个 javascript 函数,该函数在弹出窗口本身中显示警报。当我尝试 onCLick(onY()); 时仅在我关闭弹出窗口后才会出现警报。

'<div id="SearchLiteDef-yahoo" style="'+
            'font-family:arial; font-size: 12px; float: left; cursor: auto; background-color: #DDD; '+
            'margin: 0 3px ' + margin + 'px; '+
            'padding: 0 3px; -moz-border-radius: 2px; width: auto;' +
            'height: ' + windowButtonHeight + 'px; '+
            'font-size: 12px; '+
            'line-height: ' + windowButtonTextSize + 'px; '+
            'font-weight: bold"><a href="#" onClick="onY(document.popupNode);" style="text-decoration: none;">Y!</a></div>'+
        ''+

这是调用弹出窗口的部分。我想调用该函数

this.onY = function(e){
alert("Hello");
}

仅当我关闭弹出窗口时才会出现警报。我希望警报出现在弹出窗口内。

谢谢, 基兰

I have a firefox addon which opens a document.popup window. When I click a link within the popup, I want to call a javascript function which displays an alert within the popup itself. When I try onCLick(onY()); the alert comes only after I close the popup.

'<div id="SearchLiteDef-yahoo" style="'+
            'font-family:arial; font-size: 12px; float: left; cursor: auto; background-color: #DDD; '+
            'margin: 0 3px ' + margin + 'px; '+
            'padding: 0 3px; -moz-border-radius: 2px; width: auto;' +
            'height: ' + windowButtonHeight + 'px; '+
            'font-size: 12px; '+
            'line-height: ' + windowButtonTextSize + 'px; '+
            'font-weight: bold"><a href="#" onClick="onY(document.popupNode);" style="text-decoration: none;">Y!</a></div>'+
        ''+

This is the section which calls the popup. I want to call the function

this.onY = function(e){
alert("Hello");
}

The alert comes only when I close the popup window. I want the alert to come inside the popup window.

Thanks,
Kiran

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

感情废物 2024-09-24 22:38:53

我认为问题在于您尝试在弹出窗口中打开弹出窗口。 AFAIK 在任何给定时间只能有 1 个弹出窗口。

I think the problem is that you try to open a popup within a popup. You can only have 1 popup at any given time AFAIK.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文