iframe 自适应高度

<script type="text/javascript">
function resizeFrame(frm) {
frm.style.height = "auto";
contentHeight = frm.contentWindow.document.body.scrollHeight;
frm.style.height = contentHeight + 4 + "px";
}
</script>

 

<iframe style="visibility: inherit; width: 100%;" frameborder="0" marginheight="0"
marginwidth="0" scrolling="auto" id="ifm" name="ifm" onload="resizeFrame(this)">
</iframe>

posted on 2013-09-12 16:44  Kevin Kim  阅读(134)  评论(0编辑  收藏  举报

导航