Needed auto resized iframe for my own content, and after few hours this is a working result:
Here is the code for the iframe with id="ifrm"
body tag of the iframe content should look like this:Code:function autoIframe(){ var x = 0; ///////////// reset iframe size for Opera ////////////// if(navigator.userAgent.indexOf("Opera")!=-1){ this.document.body.scrollHeight = this.document.body.offsetHeight } /////////////////////IE, Opera/////////////////////////////// var y = this.document.body.scrollHeight; while (x < y){ x+=1; } parent.document.getElementById("ifrm").style.height = x ///////////////////// Firefox ////////////////////////////// if(navigator.userAgent.indexOf("Firefox")!=-1){ parent.ifrm.frameElement.height = this.document.body.scrollHeight+5; } }
Tested with Opera 9.0, IE 7.0, Firefox 2.0Code:<body onload="autoIframe()">
Cheers!



Reply With Quote
Bookmarks