2015-09-07 60 views
1
var win = Ext.create('Ext.window.Window', { 
     title: "Window", 
     modal:true, 
     width: 570, 
     height: 440,    
     layout: 'card', 
     items:[{ 
       xtype: "panel", 
       border: true, 
       bodyBorder: true, 
       title: 'Panel', 
       bodyStyle: { 
         "background": "linear-gradient(to left, #fff , #6799ff)" 
       }, 
       id: 'PanelID', 
       items:[{ 
         xtype: 'box', 
         id: 'BoxID', 
         title:'Box', 
         width: 558, 
         height: 325, 
         autoEl: { 
          tag: 'iframe' 
         }, 
         listeners: { 
          'boxready': function() { 

          var popWindowdoc = Ext.getCmp('BoxID').el.dom.contentDocument; 
          $(popWindowdoc.body).append('<div id="t" tabindex="0"/>'); 
          $(popWindowdoc.getElementById('t')).append('This is Test'); 
          } 
         } 
       }] 
      } 
     ] 


    }); 

    win.show(); 

此代码在chrome中运行良好,我在窗口中显示“This is Test”。 但在Firefox中,我没有收到任何文字,也没有发生错误。我认为这是一个渲染问题。Ext JS中的Firefox渲染问题

任何机构让我知道我将如何在这种情况下获得文本?

+0

我有同样的问题是指我的问题:http://stackoverflow.com/questions/31529917/content-in-iframe-shows-in-chrome-but-not -in-firefox我会尝试回答你的问题,因为这个问题的本质是非常微妙的。支持.... – zer00ne

回答

0

Firefox会将您的部分代码碎片化,如果可能的话您需要以只包含一组括号的方式重构您的代码[{ ...}]请参阅如何查看2 items?那一定是只有1 items

items:[{ 
      xtype: "panel", 
      border: true, 
      bodyBorder: true, 
      title: 'Panel', 
      bodyStyle: { 
        "background": "linear-gradient(to left, #fff , #6799ff)" 
      }, 
      id: 'PanelID', 
      items:[{ 
        xtype: 'box', 
        id: 'BoxID', 
        title:'Box', 
        width: 558, 
        height: 325, 
        autoEl: { 
         tag: 'iframe' 
        }, 
        listeners: { 
         'boxready': function() { 

         var popWindowdoc = Ext.getCmp('BoxID').el.dom.contentDocument; 
         $(popWindowdoc.body).append('<div id="t" tabindex="0"/>'); 
         $(popWindowdoc.getElementById('t')).append('This is Test'); 
         } 
        } 
      }]