当前位置:Gxlcms > JavaScript > Iframe自动适应页面的高度示例代码_javascript技巧

Iframe自动适应页面的高度示例代码_javascript技巧

时间:2021-07-01 10:21:17 帮助过:13人阅读

代码如下:

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;
}
}
}

代码如下:


人气教程排行