当前位置 : 主页 > 网络编程 > JavaScript >

iframe框架根据内容自动伸缩高度

来源:互联网 收集:自由互联 发布时间:2021-07-03
script language="javascript" function autoResizeIframe() { var fheight; fheight = window.zxpage.document.body.scrollHeight; if (fheight=500) fheight = 550; document.getElementById("zxpage").height = fheight+50; }/script iframe name="zxpage"
 
<script language="javascript">
    function autoResizeIframe() {
    var fheight;
    fheight = window.zxpage.document.body.scrollHeight;
    if (fheight<=500)
        fheight = 550;
        document.getElementById("zxpage").height = fheight+50;
    }
</script>
 <iframe name="zxpage" src="/zx/xx.asp" id="zxpage" onload="javascript:autoResizeIframe()"  width="100%" style="border: none;"></iframe>

网友评论