showModalDialog()在IE11浏览器中无法正常工作

时间:2014-07-03 13:20:19

标签: javascript html internet-explorer-11 ie11-developer-tools

我正在尝试使用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中打开一个默认的小尺寸窗口。

2 个答案:

答案 0 :(得分:2)

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

只需使用绝对定位的div来显示HTML内容,或者为了易于使用而实现jQueryUI对话框:http://jqueryui.com/dialog/

答案 1 :(得分:0)

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

但是showModalDialog有不同的参数,冒号而不是等于: window.showModalDialog(&#39; http://www.google.com&#39;,&#39; popWin&#39;,&#39; dialogHeight:950,dialogWidth:950,scroll:no&#39;)