0
点赞
收藏
分享

微信扫一扫

Iframe自动适应高度

思考的鸿毛 2022-05-19 阅读 68
var ifrm = document.getElementById("Iframe_com");
ifrm.src=url;
ifrm.className="vis1";
ifrm.style.height=ifrm.document.body.scrollHeight+1+"px";

又或者

function Iframe_com_onload()
{
document.all.Iframe_com.style.height=(Iframe_com.document.body.scrollHeight+50)+"px";
window.scrollTo(0,0);
}
<iframe id="Iframe_com" frameborder="0" width="100%"
onload="Iframe_com_onload();"></iframe>



举报

相关推荐

0 条评论