html 框架自适应高度

 <!--iframe 自动增高-->
                <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>

posted @ 2012-01-13 14:34  BeyondMyself  阅读(720)  评论(0编辑  收藏  举报