例子,iframe 自动适应页面高度。
 
复制代码 代码示例:
function SetCwinHeight(obj) { 
var cwin = obj; 
if (document.getElementById) { 
if (cwin && !window.opera) { 
if (cwin.contentDocument && cwin.contentDocument.body.offsetHeight) 
cwin.height = cwin.contentDocument.body.offsetHeight + 30; 
else if (cwin.Document && cwin.Document.body.scrollHeight) 
cwin.height = cwin.Document.body.scrollHeight + 30; 
} 
} 
}
页面内容部分:
 
复制代码 代码示例:
<iframe id="IframeId_help" scrolling="no" onload="
javascript:SetCwinHeight(this)" 
width="670px" style="border: 0px" frameborder="0"></iframe>