Iframe 높이 적응성

5029 단어 iframe
          <script language="javascript" type="text/javascript">

        function iframeAutoFit(iframeObj) {

            setTimeout(function () {

                if (!iframeObj) return;

                iframeObj.height = (iframeObj.Document ? iframeObj.Document.body.scrollHeight : iframeObj.contentDocument.body.offsetHeight);

            }, 200)

            document.getElementById('tr-iframe').style.display = 'block';

        }

    </script>

  <table border="0" cellpadding="0" cellspacing="0" width="100%">

            <tr id='tr-iframe' style='display: none'>

                <td>

                    <iframe allowtransparency="true" src="" frameborder="0" height="100" width="100%"

  style='background-color:transparent;filter:alpha(opacity=100);'     scrolling="no" align="center" id="frameid" name="framename" onload="javascript:iframeAutoFit(this)"

                        vspale="0"></iframe>

                </td>

            </tr>

        </table>

 
        function SetWinHeight(obj) {

            var win = obj;

            if (document.getElementById) {

                if (win && !window.opera) {

                    if (win.contentDocument && win.contentDocument.body.offsetHeight)

                        win.height = win.contentDocument.body.offsetHeight;

                    else if (win.Document && win.Document.body.scrollHeight)

                        win.height = win.Document.body.scrollHeight;

                }

            }

        }

좋은 웹페이지 즐겨찾기