showModalDialog()在IE11浏览器中不能正常工作



我试图使用window.showModalDailog()方法创建一个可变大小的弹出窗口。但是它总是打开默认的小窗口。

<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中打开一个默认的小窗口

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

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

您正在使用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')

最新更新