Skip to content

Js获取Iframe页面高度,并将高度赋值给Iframe #2

@JQqingFirst

Description

@JQqingFirst
<iframe src="default.html" id="mainweb" name="mainweb" width="100%" height="100%" frameborder="0" onLoad="iFrameHeight()" ></iframe> <script type="text/javascript" language="javascript"> function iFrameHeight() { var ifm= document.getElementById("mainweb"); var subWeb = document.frames ? document.frames["mainweb"].document : ifm.contentDocument; if(ifm != null && subWeb != null) { ifm.height = subWeb.body.scrollHeight; } } </script>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions