1

我正在尝试使用 window.showModalDailog() 方法创建一个可变大小的 POP UP。但它总是打开到默认的小尺寸窗口。

<html>
<body>
<a href="#" onclick="javascript:void window.showModalDialog('http://www.google.com','width=950,height=950,toolbar=0,menubar=0,location=0,status=1,scrollbars=0,resizable=0,left=0,top=0');return false;">Pop-up Window</a>
</body>
</html>

问题:上面的代码没有打开大小(950 * 950)的窗口,尽管每次它在 IE11 中打开一个默认的小尺寸窗口。

4

2 回答 2

2

showModalDialog 很可能很快就会被弃用(参见http://dev.opera.com/articles/showmodaldialog/),所以我建议不要使用它。

只需使用绝对定位的 div 来显示您的 HTML 内容,或实现一个 jQueryUI 对话框以方便使用:http: //jqueryui.com/dialog/

于 2014-07-03T13:41:48.543 回答
0

您正在使用 window.open() 的参数...
window.open(' http://www.google.com ','width=950, height=950, scrollbars=0')

但 showModalDialog 有不同的参数,用冒号代替等号: window.showModalDialog(' http://www.google.com ', 'popWin', 'dialogHeight:950, dialogWidth:950, scroll:no')

于 2017-06-16T19:13:45.510 回答