zoukankan      html  css  js  c++  java
  • How to adjust IFrame height on it's content (转载)

    http://www.codeproject.com/useritems/Adjust_An_iFrame_Height.asp

    <iframe id='myFrame' frameborder=0 scrolling=no width=100%  src="..."
        <EM>onload='adjustMyFrameSize();'</EM>></STRONG> <STRONG>
    </iframe>

    Then you need to place such script BEFORE IFrame element: </P>

     <script type="text/javascript">
       
        function getElement(aID)
        {
            return (document.getElementById) ?
                document.getElementById(aID) : document.all[aID];
        }

        function getIFrameDocument(aID){
            var rv = null;
            var frame=getElement(aID);
            // if contentDocument exists, W3C compliant (e.g. Mozilla)
            if (frame.contentDocument)
                rv = frame.contentDocument;
            else // bad IE  ;)
                rv = document.frames[aID].document;
            return rv;
        }

        function adjustMyFrameHeight()
        {
            var frame = getElement("myFrame");
            var frameDoc = getIFrameDocument("myFrame");
            frame.height = frameDoc.body.offsetHeight;
        }
    </script>

  • 相关阅读:
    iOS基础
    iOS基础 ----- 内存管理
    NSAttributedString 的一些基本用法
    node安装使用
    docker常用命令
    docker lnmp
    easy-wechat
    composer
    center7系统搭建lnmp
    xammp环境配置
  • 原文地址:https://www.cnblogs.com/margiex/p/809170.html
Copyright © 2011-2022 走看看