項目中用extjs作前提
系統的界面是
左邊用樹作目錄 右邊用tabpanel作內容展現
點擊樹節點的時候 在tabpanel添加新的tabhtml
- 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
有沒有人遇到這個問題的呢java
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>" } }));c++
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的時候出問題的post
to 3id衝突的可能性不大 在ie6和ff下都正常有沒有試過在ie8下 用tab調用iframe引用的頁面用viewport的狀況學習
弄了 幾天 總算把問題解決了就是在頁面上把第一句的doctype刪掉就正常啦 這個問題只在ie8發生答案具體在這裏http://bbs.misonsoft.com/thread-1941-1-1.html那這題當散分 來者有份 下週結貼ui
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>" }]this
不是代碼的問題,瀏覽器的問題,IE8是這樣,我恰好前幾天遇到過,個人解決方案是在首頁加代碼把IE瀏覽器的標準改了,不管客戶用的什麼IE,都是按照IE7的標準來的,但願對樓主有幫助在首頁加入<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />