showModalDialog - IE11忽略dialogHeight和dialogWidth

时间:2016-04-07 07:16:46

标签: javascript jsp internet-explorer-11 showmodaldialog

showModalDialog IE11遇到问题。对话框窗口工作正常,但忽略宽度和高度参数。该对话框在一个非常小的窗口中打开,用户需要调整它的大小。

我知道Chrome中已弃用此功能,我知道其他选项,如jQuery-UI对话框,但我想知道是否可以使用showModalDialog修复IE11的此问题。

js code:

var url = "/xxWar/xxModal.jsp?title=xx&frameUrl=/xxWar/xxServlet%3Faction%3Dxx";
var value = showModalDialog(url, init, "dialogWidth:" + width + "px;dialogHeight:" + height + "px;resizable:yes;status:no;scroll:yes;help:no");

和xxModal.jsp:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
        <title><%=request.getParameter("title")%></title>
    </head>
    <frameset rows="0,*" frameborder="no" border="0" framespacing="0">
        <frame src="" name="header">
        <frame src="<%=request.getParameter("frameUrl")%>" name="main" id="main">
    </frameset>
    <noframes>
        <body>
        </body>
    </noframes>
</html>

谢谢!

3 个答案:

答案 0 :(得分:1)

<meta http-equiv="X-UA-Compatible" content="IE=7">

答案 1 :(得分:0)

我修复了在de modal.jsp:

中添加此行<meta http-equiv="X-UA-Compatible" content="IE=7">的问题
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
<html>
    <head>
        <meta http-equiv="X-UA-Compatible" content="IE=7"> 
        <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
        <title><%=request.getParameter("title")%></title>
    </head>
    <frameset rows="0,*" frameborder="no" border="0" framespacing="0">
        <frame src="" name="header">
        <frame src="<%=request.getParameter("frameUrl")%>" name="main" id="main">
    </frameset>
    <noframes>
        <body>
        </body>
    </noframes>
</html>

答案 2 :(得分:-1)

你不需要回到IE7,设置content="IE=9"也有效 - 这就是我们使用的&amp;我们设定了高度和高度宽度根据我们的需要;)