当前位置:编程学习 > JS >>

extjs window js引入问题

现在使用的版本

extjs3.3.1

在extjs中window加载的是一个jframe,而iframe中引入了js,在这个时候js不能运行,但是在火狐中是OK的,在IE6.0(开发中一般会使用IE6.0)不可以加载js,

这个问题需要你加载完成之后重新reload()一下即可

[javascript] var myHtml='<iframe id="ifrm008" name="ifrm008" scrolling="auto" frameborder="0" width="100%"height="100%" src="/his/inpatient!detailUI.action{0}"></iframe>'; 
    myHtml=myHtml.replace('{0}',params); 
   // alert(myHtml); 测试打印输出  
       //new 窗体显示结果  
 this.detailWin=new top.Ext.Window({ 
        title: "医院住院病人住院明细", 
         layout:'fit', 
         height: 600, 
      width: 800, 
         closeAction:'hide', 
         plain: true, 
         modal : true, 
         listeners:{ 
            afterrender:function(window){ 
                //加载数据,刷新数据  
                //alert(top.frames['ifrm001'].location);  
                top.frames['ifrm008'].location.reload(); 
                //var mysrc=self.document.getElementById('ifrm001').src;  
                //document.getElementById('ifrm001').src=mysrc;  
            } 
         }, 
         html : myHtml 
      }); 
   var myHtml='<iframe id="ifrm008" name="ifrm008" scrolling="auto" frameborder="0" width="100%"height="100%" src="/his/inpatient!detailUI.action{0}"></iframe>';
       myHtml=myHtml.replace('{0}',params);
      // alert(myHtml); 测试打印输出
          //new 窗体显示结果 www.zzzyk.com
    this.detailWin=new top.Ext.Window({
           title: "医院住院病人住院明细",
            layout:'fit',
            height: 600,
         width: 800,
            closeAction:'hide',
            plain: true,
            modal : true,
            listeners:{
             afterrender:function(window){
              //加载数据,刷新数据
              //alert(top.frames['ifrm001'].location);
              top.frames['ifrm008'].location.reload();
              //var mysrc=self.document.getElementById('ifrm001').src;
              //document.getElementById('ifrm001').src=mysrc;
             }
            },
            html : myHtml
         });上面replace('{0}',params);是参数;

在以上代码中在IE和火狐中运行都是OK的,[javascript] top.frames['ifrm008'].location.reload(); 
top.frames['ifrm008'].location.reload();用这个进行重新加载显示页面,extjs加载后js不会执行,所以需要使用reload重新加载窗体



摘自 yhc13429826359的专栏
 

补充:web前端 , JavaScript ,
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,