[Home]
[Edit this page]
[Recent Changes]
[Special Pages]
[Help]
How_To_Javascript_Set_Iframe_Width_Height_Onload
Place this in the body of your HTML document.
This sets the iframe's properties with JavaScript in the onload of the iframe tag which will execute only when the iframe has fully loaded.
Related threads:
getting size of iframe contents onload()
JavaScript FAQ
[Edit this page] [Page history] [What links here] [Discuss this topic] [Printer Friendly]
How_To_Javascript_Set_Iframe_Width_Height_Onload
How to set an iframe's width and height properties?
The example shows how to reference an element which is contained in a child of the window object. Place this in the head of your HTML document.<script type="text/javascript">
function setSize()
var iframeElement = parent.document.getElementById('iframeName');
iframeElement.style.height = 100; //100px or 100%
iframeElement.style.width = 100; //100px or 100%
</script> Place this in the body of your HTML document.
<iframe name="iframeName" id="iframeName" onload="setSize()"></iframe>
This sets the iframe's properties with JavaScript in the onload of the iframe tag which will execute only when the iframe has fully loaded.
Related threads:
getting size of iframe contents onload()
JavaScript FAQ
[Edit this page] [Page history] [What links here] [Discuss this topic] [Printer Friendly]
