項目中用extjs做前提
系統的界面是
左邊用樹做目錄 右邊用tabpanel做內容展示
點擊樹節點的時候 在tabpanel添加新的tab
- JScript code
-
var newTab = centerPanel.add(new Ext.Panel({ id : tabId, title : tabTitle, iconCls : "treeNodeLeafIcon", layout : 'fit', border : false, closable : true, listeners : { activate : this.onActiveTabSize, scope : this }, items : { html : "<iframe width=\"100%\" height=\"100%\" scrolling=\"auto\" frameborder=\"0\" src=http://topic.csdn.net/u/20100715/14//""+_link+"\" ></iframe>" } }));
在ie6 ff下是正常的
不過就是在ie8下就出問題了
當iframe引用的頁面是用viewport布局的時候就沒有顯示內容
點擊別的tab再點擊回來 viewport里面的內容有正常而來
如果點擊樹的節點的話viewport的內容又不見了
這個是不是extjs在ie8下的bug
有沒有人遇到這個問題的呢
已經有8 個評論

var newTab = centerPanel.add(new Ext.Panel({ id : tabId, //把id屬性去掉試試 title : tabTitle,iconCls : "treeNodeLeafIcon",layout : ‘fit’,border : false, closable : true, listeners : { activate : this.onActiveTabSize, scope : this }, items : {html : "<iframe width=\"100%\" height=\"100%\" scrolling=\"auto\" frameborder=\"0\" src=http://topic.csdn.net/u/20100715/14//""+_link+"/" ></iframe>" } }));
html: ‘<iframe id="iframe" src=http://topic.csdn.net/u/20100715/14//” + _link.url + ‘\’ frameborder="0" scrolling="auto" style="border:0px none;height:100%; width:100%;"></iframe>’
CSS code
如果id沒有必須的用途,就不需要為組件添加id
如果id一旦重復就會造成組件顯示問題或是出現js沖突
試用了 還是老樣子我這個代碼在ie6和ff能正常跑的就是在ie8的時候出問題的
to 3id沖突的可能性不大 在ie6和ff下都正常有沒有試過在ie8下 用tab調用iframe引用的頁面用viewport的情況
弄了 幾天 總算把問題解決了就是在頁面上把第一句的doctype刪掉就正常啦 這個問題只在ie8發生答案具體在這里http://bbs.misonsoft.com/thread-1941-1-1.html那這題當散分 來者有份 下周結貼
items : {html : "<iframe width=\"100%\" height=\"100%\" scrolling=\"auto\" frameborder=\"0\" src=http://topic.csdn.net/u/20100715/14//""+_link+"/" ></iframe>" }這個寫法我感覺有點問題,最好還是這樣吧:items : [{html : "<iframe width=\"100%\" height=\"100%\" scrolling=\"auto\" frameborder=\"0\" src=http://topic.csdn.net/u/20100715/14//""+_link+"/" ></iframe>" }]
不是代碼的問題,瀏覽器的問題,IE8是這樣,我剛好前幾天遇到過,我的解決方案是在首頁加代碼把IE瀏覽器的標准改了,無論客戶用的什么IE,都是按照IE7的標准來的,希望對樓主有幫助在首頁加入<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />