网上有人写了Ext.Js的Panel放入iframe的三种方法。但我要在Ext.Net放入,于是参考它的方法实现了此功能。
我的代码如下:
<ext:Panel ID="PanelCenter" runat="server" Layout="Fit" Region="Center" Frame="true"
Html="<iframe id='DataShow' frameborder='0' width='100%' height='100%'></iframe>">
</ext:Panel>
Html="<iframe id='DataShow' frameborder='0' width='100%' height='100%'></iframe>">
</ext:Panel>
网上的Ext.Js的Panel放入iframe的三种方法如下,原文地址:http://www.cnblogs.com/hannover/archive/2011/01/24/1943507.html
方法一:
//定义Iframe
var frame1 = document.createElement("IFRAME");
frame1.id = "frame1";
frame1.frameBorder = 0;
frame1.src = "xxx.html";
frame1.height = "100%";
frame1.width = "100%";
//添加
var panel2 = new Ext.Panel( {
id : "panel2",
items: [ frame1 ]
//contentEl: "frame1" //this won't work
});
var frame1 = document.createElement("IFRAME");
frame1.id = "frame1";
frame1.frameBorder = 0;
frame1.src = "xxx.html";
frame1.height = "100%";
frame1.width = "100%";
//添加
var panel2 = new Ext.Panel( {
id : "panel2",
items: [ frame1 ]
//contentEl: "frame1" //this won't work
});
方法二:
var panel2 = new Ext.Panel( {
id: "panel2",
fitToFrame: true,
html: '<iframe id="frame1" src="xxx.html" frameborder="0" width="100%" height="100%"></iframe>'
});
id: "panel2",
fitToFrame: true,
html: '<iframe id="frame1" src="xxx.html" frameborder="0" width="100%" height="100%"></iframe>'
});
方法三:
var panel2 = new Ext.Panel( {
id: "panel2",
contentEl: "frame1"
});
// 后面将frame导航到其它URL
document.getElementById("frame1").src = "xxx.html";
id: "panel2",
contentEl: "frame1"
});
// 后面将frame导航到其它URL
document.getElementById("frame1").src = "xxx.html";