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

时间:2014-02-26    点击:117   

复制代码 代码如下:

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>

简单选项卡 js和jquery制作方法分享
display和visibility的区别示例介绍
js 赋值包含单引号双引号问题的解决方法
js返回上一页并刷新的多种实现方法
网站内容禁止复制和粘贴、另存为的js代码
> 返回     
地址:上海市普陀区胶州路941号长久商务中心 电话: QQ:
© Copyright 2012 上海网络 Product All Rights Reserved