S
sam
Hi all,
Hope some expert can help me resolve this.
I am using the following code to resize an iframe according to the
content in it so that the iframe does not use its scroll bar and uses
the parent window scroll bar. This code works perfectly fine in IE but
not in Firefox.. The iframe does not resize according to the content.
function resizeIframe(id)
{
frame = document.getElementById(id);
innerDoc = (frame.contentDocument) ? frame.contentDocument :
frame.contentWindow.document;
objToResize = (frame.style) ? frame.style : frame;
if ( IE)
{ objToResize.height = innerDoc.body.scrollHeight + 3; }
else if (firefox)
{
objToResize.height = innerDoc.body.scrollHeight + 3;
alert(innerDoc.body.scrollHeight);
}
}
I noticed that (innerDoc.body.scrollHeight) works only when the iframe
just keeps on expanding for various calls.. But say after 1 or 2 calls
if the content is very little the iframe does not shrink back.
Any help really appreciated.
Thanks,
Sam
Hope some expert can help me resolve this.
I am using the following code to resize an iframe according to the
content in it so that the iframe does not use its scroll bar and uses
the parent window scroll bar. This code works perfectly fine in IE but
not in Firefox.. The iframe does not resize according to the content.
function resizeIframe(id)
{
frame = document.getElementById(id);
innerDoc = (frame.contentDocument) ? frame.contentDocument :
frame.contentWindow.document;
objToResize = (frame.style) ? frame.style : frame;
if ( IE)
{ objToResize.height = innerDoc.body.scrollHeight + 3; }
else if (firefox)
{
objToResize.height = innerDoc.body.scrollHeight + 3;
alert(innerDoc.body.scrollHeight);
}
}
I noticed that (innerDoc.body.scrollHeight) works only when the iframe
just keeps on expanding for various calls.. But say after 1 or 2 calls
if the content is very little the iframe does not shrink back.
Any help really appreciated.
Thanks,
Sam