0

Hello:

I'm using this script as an auto resize function for an iframe, but can't get it to work in safari.

<script type="text/javascript">
<!--
function calcheight()
{ 
var the_iframe = document.getElementById('paymentHistory');
var the_document = (the_iframe.contentWindow ¦¦ the_iframe.contentDocument);
if(the_document.document) the_document = the_document.document;
var the_height= the_document.body.scrollHeight;} 
//--> 
</script>

to call the function, I have

<iframe id="paymentHistory" onload="calcHeight()" src="/andy/admin/categories/printpaymenthistory.php"></iframe>

any thoughts as to what is wrong

Edited by mbarandao: n/a

2
Contributors
3
Replies
4
Views
6 Years
Discussion Span
Last Post by mbarandao
0

Well, you call the function calcHeight, however in your javascript code, the function is called calcheight , (notice the caption). Also your function just retrieves the height? I assume you have some code that sets the height of the iframe that you have not posted.

~G

0

I thank you for your post. Let me restate my intention:

I previously was using this function for Iframe resizing:

<script type="text/javascript"><!--
function calcHeight(elem)
{
	var the_height=50;
	var padding=30;
	try
	{
		if( elem.contentWindow && elem.contentWindow.document)
		{
			the_height=elem.contentWindow.document.body.scrollHeight;
		}
	}
	catch(e){}
	elem.height=the_height +padding;
}
//--></script>

this function works fine in ie and ff but not safari. I'm currently working on a project that I need to run only on safari. I need to find a fix to enable the calcHeght() to work.

My earlier post was a suggestion --which I have not been able to communicate with the original author.

So, can someone assist with causing the above function to work in safari or make another recommendation.

And btw, Graphix, thanks for pointing that error out!
Thank you!
Mossa

Edited by mbarandao: n/a

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.