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

Recommended Answers

All 3 Replies

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

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

Issue resolved! ... went with a different idea!

Best,
Mossa

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.