Iframe自适应高度绝对好使的代码 兼容IE,遨游,火狐[转]
生活随笔
收集整理的這篇文章主要介紹了
Iframe自适应高度绝对好使的代码 兼容IE,遨游,火狐[转]
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
Iframe自適應(yīng)高度絕對好使的代碼,IE、遨游、火狐、Chrome都兼容,需要的朋友可以參考下。
這是我試了很多相關(guān)代碼后發(fā)現(xiàn)的兼容性最好的Iframe自適應(yīng)高度代碼。
?
<script type="text/javascript"> function reinitIframe(){ var iframe = document.getElementById("mainFrame"); try{ var bHeight = iframe.contentWindow.document.body.scrollHeight; var dHeight = iframe.contentWindow.document.documentElement.scrollHeight; var height = Math.max(bHeight, dHeight); iframe.height = height; }catch (ex){} } window.setInterval("reinitIframe()", 200); </script>?
?
?
轉(zhuǎn)載于:https://www.cnblogs.com/rabtor/archive/2012/06/03/2532476.html
總結(jié)
以上是生活随笔為你收集整理的Iframe自适应高度绝对好使的代码 兼容IE,遨游,火狐[转]的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: windows7 设置 Local Se
- 下一篇: NET插件系统之四——提升系统搜索插件和