打开弹出窗口在 Firefox 和 google chrome 中不起作用

发布于 2024-08-18 22:37:25 字数 392 浏览 3 评论 0原文

我想在用户单击按钮时打开一个弹出窗口(仅带有关闭按钮),并且应禁用父窗口,直到弹出窗口关闭。为此,我使用以下代码

function popup_window(url) {

     popupwin = window.showModalDialog(url,null,'height=20,width=150,status=no,resizable=no,scrollbars=no,toolbar=no,location=no,menubar=no');     
     }

无论如何,该代码在 IE 中运行良好。但是,我有两个问题。 在 Firefox 中,它无法以我在脚本中提到的大小打开。它正在以全尺寸打开。在 Google Chrome 中,父窗口不会被禁用。

提前致谢

I want to open a popupwindow (with close button only) when the user clicks a button and the parent window should be disabled until the popup window closed. For that I'm using the following code

function popup_window(url) {

     popupwin = window.showModalDialog(url,null,'height=20,width=150,status=no,resizable=no,scrollbars=no,toolbar=no,location=no,menubar=no');     
     }

Anyhow, this code is working perfectly in IE. But, I hav two problems.
In firefox, it is not opening with the size I've mentioned in the script. It is opening in full size. And In Google Chrome, parent window is not getting disabled.

Thanks in Advance

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

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

发布评论

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

评论(1

独﹏钓一江月 2024-08-25 22:37:25

参数的语法不同。例如:

window.showModalDialog(url, null, 
"dialogwidth: 150; dialogheight: 20; resizable: no")

The syntax of the args is different. For example:

window.showModalDialog(url, null, 
"dialogwidth: 150; dialogheight: 20; resizable: no")
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文