1. ExtJS下使用:
<iframe id="myTabBody " src="" scrolling="no" frameborder="0" height="100%"
width="100%" ></iframe>
主页面调用子页面:
window.frames["myTabBody"].Ext.get("schemeId").getValue();
子页面调用主页面:
window.parent.Ext.getCmp('schemeListGrid').getSelectionModel().getSelected().get('schemeId');
2. iframe高度自适应:
方法1:
父页面中:
<div id="contentId "></div>
子页面中:
function resetFrameHeight(){
parent.document.getElementById("contentId").style.height =
document.body.scrollHeight +"px";
}
window.onload=resetFrameHeight;
方法2:(不推荐)
function reSetFrameHieght(){
var iframe = document.getElementById("myTabBody");
try{
var bHeight = iframe.contentWindow.document.body.scrollHeight;
var dHeight = iframe.contentWindow.document.documentElement.scrollHeight;
var height = Math.max(bHeight, dHeight);
iframe.height = height;
}catch (ex){}
}
window.setInterval("reSetFrameHieght()", 200);