根据内容更改自动调整IE模式对话框

时间:2013-11-20 03:56:32

标签: jquery dialog modal-dialog internet-explorer-9 showmodaldialog

使用浏览器:IE 9

我使用window.showModalDialog()函数打开IE模式对话框。

打开对话框时,我使用dialogHeight和dialogWidth属性提供高度和宽度。这很好。

但要求是当对话框的内容发生变化时,我想调整对话框的高度。

最初,对话框中隐藏了某些元素,并且由于对话框中的垂直滚动条,这些元素将在用户操作中可见,并避免我想调整对话框高度。

请建议。

谢谢, 阿米特

2 个答案:

答案 0 :(得分:1)

您可以在模式对话框打开的页面中调整大小。例如,请查看以下代码:

t3.html

    <!DOCTYPE HTML>
    <html>
    <head>
    <title>test</title>
    </head>
    <body>
        test<br>
        test adjust<br>
        test adjust<br><br>
        <script language=javascript>
            function adjustDialog() {
                window.dialogHeight = 400+'px';
                window.dialogWidth = 400+'px';
    }

        </script>

        <button onclick="adjustDialog();">Adjust me</button>
    </body>
    </html>

t4.html

    <!DOCTYPE HTML>
    <html>
    <head>
        <title>test</title>
    </head>
    <body>
    <script language=javascript>
        window.showModalDialog("t3.html","Dialog Box","dialogHeight: 300px; dialogWidth: 300px; dialogTop: 250px; dialogLeft: 300px; edge: Sunken; center: No; help: No; resizable: No; status: No;");
    </script>
    </body>
    </html>

打开t4.html,然后弹出一个模态对话框,单击其中的按钮,可以调整对话框。

答案 1 :(得分:0)

根据http://msdn.microsoft.com/en-us/library/ie/ms536759(v=vs.85).aspx,如果resizable中的varOptions值(showModalDialog()调用的第三个参数)设置为“是”(或1),则模态应自动调整大小

相关问题