您的位置:首页 > Web前端 > JavaScript

Extjs中如何关闭parent对象窗口打开的window对象

2010-07-26 09:25 477 查看
<script type="text/javascript">
function openWindow(id,title,url,width,height){
    var win = Ext.get(id)
    if (win) {
        win.close();
        return;
    }
    win = new Ext.Window({
        id:id,
        title:title,
        layout:'fit',
        width:width,
        height:height,
        closeAction:'close',
        collapsible:true,
        plain: false,
        resizable: true,
        html : '<iframe frameborder="0" width="100%" height="100%" src="'+url+'"></iframe>'
    });
    win.show();
}

function myfunction(){
    openWindow('b-win','窗口中打开b页面','b.htm',400,300);
}
</script>
<input type="button" name="button1" value="打开窗口" onClick="myfunction()">

b.htm(部分代码)

<script type="text/javascript">
function closewin(){
    var win = parent.Ext.getCmp('b-win');
    if (win) {win.close();}
}
</script>
<input type="button" name="button1" value="关闭a打开的窗口" onClick="closewin()">

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息