Insert iframe on page
<iframe scrolling='no' frameborder='0' id='frmid' src=’getad.aspx' onload='javascript:resizeIframe(this);'> </iframe>
Use this javascript to resize iframe based on the height & width of child page
<script language="javascript" type="text/javascript"> function resizeIframe(obj) { obj.style.height = obj.contentWindow.document.body.scrollHeight + 'px'; obj.style.width = obj.contentWindow.document.body.scrollWidth + 'px'; } </script>
What does this code do? When the body of the parent frame loads, it looks up the document element “childframe” which corresponds to the iframe. Then the page calls a function resizeFrame(). The function sets the height of the frame to be the scrollHeight, which effectively removes the scrollbar.
happy programming!
No comments:
Post a Comment