不记得是从哪里看到的
function initParentHeight(){
var div = document.getElementById('contentFrame');
div.style.height=window.document.body.scrollHeight||window.document.body.offsetHeight+5;
}
function SetWinHeight(obj){
var win=obj;
if(win && !window.opera){
if (win.contentWindow && win.contentWindow.document.body.offsetHeight){
var height=0;
try{
var bheight=win.contentWindow.document.body.scrollHeight;
var dheight=win.contentWindow.document.documentElement.scrollHeight;
height=Math.min(bheight,dheight);
}catch(ex){}
win.style.height = height;
}else if(win.Document && win.Document.body.scrollHeight){
win.style.height = win.Document.body.scrollHeight;
}
}
initParentHeight();
}
<iframe id="contentFrame" name="contentFrame" frameborder="0" scrolling="auto" style="border: none;height:100%;width:100%;" src="${basePath}/ccx/showOrgInfo.action?type=${type}&gid=${gid}" οnlοad="SetWinHeight(this);"></iframe>