使用Extjs的时候经常要用的一种方法,有的时候不能把HTML页面都放在一个window里面,那样页面很非常庸肿,而是用iframe来设置嵌套 直接看效果吧 image
程序代码:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>EXTJS-window弹出窗口</title>
    <link href="../ext-3.2.2/resources/css/ext-all.css" rel="stylesheet" type="text/css" />

    <script src="../ext-3.2.2/adapter/ext/ext-base.js" type="text/javascript"></script>

    <script src="../ext-3.2.2/ext-all.js" type="text/javascript"></script>

    <script type="text/javascript">
    Ext.onReady(function(){   
        var win;
        var button= new Ext.Button({
       // renderTo:Ext.getBody(),
        renderTo:’button1′,
        text:"点击打开窗口",
        listeners:{
        "click":function()     {    
        if(!win){
            win = new Ext.Window({
                applyTo:’hello-win’,
                title:’新建的窗口’,
                layout:’fit’,
                width:640,
                height:480,
                closeAction:’hide’,
                plain: true,               

                items: [{  title: ‘弹出的窗口’,
                                    header:false,
                                    html : ‘<iframe style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; width: 728px; height: 455px; border-right-width: 0px" src=http://www.google.com frameborder="0" width="100%" scrolling="no" height="100%"></iframe>’,
                                    border:false
                                }]

            });
        }
        win.show(this);
             }
        }    
        });
    });

    </script>

</head>
<body>
    <div id="button1">
    </div>
    <div id="hello-win" class="x-hidden">
</body>
</html>

不多说了, 代码很简单, 主要是在window中内嵌入iframe.