Good day, this problem: There are links all have href = "" (usually a local document) There is one frame into which the document specified in one of the clicked links is loaded as href = "" (That is, click - the frame will be like this. ..src = "lol.htm"> ...). Sometimes external documents may not fit in this frame, so you need to adjust the height, so that there would be norms. I tried the frame onLoad = "..." (googled a lot of options, none earned). I think it may be necessary to check on pressing and then wait for the frame to load and already set the height, but in JS I'm not strong, maybe this is my problem. Help me please!

    1 answer 1

    Here is the code that birches the height of the frame window

    <script type="text/javascript"> function iframeLoaded() { var iFrameID = document.getElementById('idIframe'); if(iFrameID) { iFrameID.height = ""; iFrameID.height = iFrameID.contentWindow.document.body.scrollHeight + "px"; } } </script> 

    iframe

     <iframe id="idIframe" onload="iframeLoaded()" ... 
    • Comments are not intended for extended discussion; conversation moved to chat . - Nofate