Not a Member Yet,
Click here to Register

ID: 527
Viewed: 4920
Added: Jun 15, 2004
Version: 1.0
Snippet uploaded by: snippet
Written By: Unknown
Demo: Sorry, no demo



User Rated at: 0 Stars
Rate This:

Thank you for your vote. Please wait...

It appears you already voted for this snippet

It appears your vote value was empty

I have seen this asked in more forums so i thought I would post it here in case anybody wants it.

this allows the iframe to go as big as the content inside it will want. so it really makes the heightof the iframe the same size as the content it loads in it.

browsers: IE6+, Mozilla, Netscape 6+

<!---Head--->
// add this to the page that loads "into" the iframe.

<script type="text/javascript">

function autofitIframe(id){
if (!window.opera && !document.mimeType && document.all && document.getElementById){
parent.document.getElementById(id).style.height=this.document.body.offsetHeight+"px";
}
else if(document.getElementById) {
parent.document.getElementById(id).style.height=this.document.body.scrollHeight+"px"
}
}
</script>

<!---Body--->


 /// load this in the iframe page, the src of the iframe tag.
<body onload="autofitIframe('ifrm')" >

// in the parent file "calling" the iframe you need to make it have an id.
// add this to the parent html file.

<iframe name="ifrm" id="ifrm" src="test.htm" width="400" height="600" scrolling="no" frameborder="0">Sorry, your browser doesn't support iframes.</iframe>


No Comments to show

Please completely fill out the form below if you want to review this snippet. All reviews are subject to validation.


Replying to a Comment...


Adding your comment. Please wait...

Thanks for adding your comment!. After further review it will be added.

There was a problem adding your comment. Please try again.

Please complete all the fields in the form before sending.

© 2002 - 2024 snippetlibrary.com All Rights Reserved. Conditions
Do NOT follow this link or you will be banned from the site!