Iframe 自动适应页面的高度示例代码_Javascript教程-查字典教程网
Iframe 自动适应页面的高度示例代码
Iframe 自动适应页面的高度示例代码
发布时间:2016-12-30 来源:查字典编辑
摘要:复制代码代码如下:functionSetCwinHeight(obj){varcwin=obj;if(document.getElement...

复制代码 代码如下:

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" frameborder="0"></iframe>

相关阅读
推荐文章
猜你喜欢
附近的人在看
推荐阅读
拓展阅读
  • 大家都在看
  • 小编推荐
  • 猜你喜欢
  • 最新Javascript教程学习
    热门Javascript教程学习
    编程开发子分类