PDA

View Full Version : IFrame SSI script II



dw66stk
02-18-2012, 09:00 PM
1) Script Title: IFrame SSI script II

2) Script URL (on DD):http://www.dynamicdrive.com/dynamicindex17/iframessi2.htm

3) Describe problem: I have used this script successfully on IE 8 and below. I recently purchased a new laptop that uses IE 9. When I load my webpage, the IFRAME does not dynamically change as it has on past browsers. Is there a fix for this? Please help.

This is the website that I created: http://socaphland.org

molendijk
02-18-2012, 10:24 PM
Are you talking about archive.html? It does not resize in Firefox either.
===
Arie Molendijk

dw66stk
02-19-2012, 01:00 AM
Correct. It does not resize in the latest version of Firefox as well.

molendijk
02-19-2012, 01:42 AM
Then replace the dynamicdrive script with this:

<script type="text/javascript">
/* free code from dyn-web.com */

function getDocHeight(doc) {
doc = doc || document;
// from http://stackoverflow.com/questions/1145850/get-height-of-entire-document-with-javascript
var body = doc.body, html = doc.documentElement;
var height = Math.max( body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight );
return height;

}

function setIframeHeight(id) {
var ifrm = document.getElementById(id);
var doc = ifrm.contentDocument? ifrm.contentDocument: ifrm.contentWindow.document;
ifrm.style.visibility = 'hidden';
ifrm.style.height = "10px"; // reset to minimal height in case going from longer to shorter doc
ifrm.style.height = getDocHeight( doc ) + 5+"px";
ifrm.style.visibility = 'visible';
}
</script>
and add the following to your iframe tag:

onload="setIframeHeight('myframe')"
This works with me.
===
Arie Molendijk.

dw66stk
02-19-2012, 02:21 AM
That seemed to correct my problem!! Thank you so much for taking time to look into my problem!!