...

View Full Version : dynamic iframe height; not a function, not defined.



cookiecaper
05-28-2005, 04:32 AM
I'm trying to use a function that I found on these forums to dynamically adjust the height of an iframe, but the page always returns an error stating that "heightboss is not a function" if I use document.heightboss() or "heightboss is not defined" if I just use heightboss(). This is very frustrating. It happens also with any function I put in, so I don't think it has to do with this one particular.

But here's the code:


<script type="Javascript">

//This code by narmi2 from codingforums.com. Thanks narmi!

function heightboss() {
var the_height=document.getElementById('content').contentWindow.document.body.scrollHeight;
document.getElementById('content').style.height=the_height;
}

</script>

This is the code I'm using to call it.


<iframe onLoad="javascript:top.heightboss();" name="content" id="content" width="70%" align="center" frameborder="0" scrolling="no"></iframe>

Please help.

It doesn't work in IE either. The error there is "Object doesn't support this property or method".

Thanks in advance.

canadianjameson
05-28-2005, 08:05 AM
have a look at the code i use here:

www.enviromark.ca/Project/

go to Orders -> completed or outstanding orders.

that what u need?

Mr J
05-28-2005, 11:40 AM
Or take a look at this example

www.huntingground.freeserve.co.uk/webplus/iframes/iframe_resize.htm

cookiecaper
06-01-2005, 05:00 AM
Thanks guys. I'm using that code now, Mr. J, thank you.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum