让浮动框架自动适应其子页的高度

    技术2022-05-20  36

    浮动框架:

    <div style=" width:100%;">    <iframe frameborder="0" width="100%"  id="Content" name="Main"  src="OrderTab.aspx?guid=<%=Request.QueryString["guid"].ToString() %>" ></iframe>    </div>

     

    子页:

    在body标签的onload事件中执行:

     var AdapterIframe = function() {            var iframeObj = parent.document.getElementById("Content");            iframeObj.height = iframeObj.contentWindow.document.documentElement.scrollHeight;            iframeObj.width = iframeObj.contentWindow.document.documentElement.scrollWidth;        }


    最新回复(0)