1200字范文,内容丰富有趣,写作的好帮手!
1200字范文 > iframe自适高度

iframe自适高度

时间:2023-08-23 18:10:17

相关推荐

iframe自适高度

正在踌躇的时候发现下面的这段代码,终于得意解决。苦于对js没有足够的熟悉,代码中的具体方法参数还得继续学习,感谢提供代码的朋友。

function SetCwinHeight()

{

var cwin=document.getElementById("cwin");

if (document.getElementById)

{

if (cwin && !window.opera)

{

if (cwin.contentDocument && cwin.contentDocument.body.offsetHeight)

cwin.height = cwin.contentDocument.body.offsetHeight;

else if(cwin.Document && cwin.Document.body.scrollHeight)

cwin.height = cwin.Document.body.scrollHeight;

}

}

}

<iframe width="778" align="center" height="200" id="cwin" name="cwin" οnlοad="Javascript:SetCwinHeight(this)" frameborder="0" scrolling="no"></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;

else if(cwin.Document && cwin.Document.body.scrollHeight)

cwin.height = cwin.Document.body.scrollHeight;

}

}

}

引用时

οnlοad="javascript:SetCwinHeight(this)"

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。