【发布时间】:2023-04-01 14:19:01
【问题描述】:
当 iframe 的内容是带有母版页的 asp.net 站点时,如何设置 iFrame 内容的高度?
有谁知道jQuery插件吗?
更新 这在 IE 中运行良好,但在 chrome 和 firefox 中失败
function resizeFrame(f) { f.style.height = f.contentWindow.document.body.scrollHeight + "px"; }
在正文 onload() 上调用它
body onload="resizeFrame(document.getElementById('MainIFrame'))"
iframe 代码
<iframe id="MainIFrame" class="autoHeight" runat="server" marginwidth="0" style="margin: auto; "
frameborder="0" width="100%" scrolling="no" >
</iframe>
【问题讨论】:
-
更新了一些代码...我喜欢我的 iframe 与里面的页面有相同的高度
-
请参阅:stackoverflow.com/questions/247128/how-to-auto-size-an-iframe 以及有关该主题的其他答案。
-
在 chrome 和 FF 中它们都不适合我
标签: javascript jquery asp.net iframe