[thelist] iframe as big as necessary?
Peter-Paul Koch
gassinaumasis at hotmail.com
Tue Mar 30 07:34:27 CST 2004
>>>So is there any way I can specify that an iframe should be as big as it
>>>needs to be?
>
>>What you have to do is find the document.body.offsetHeight of the page in
>>the iframe and set the height of the iframe to this value + a little bit
>>more. This works fine.
>>
>>However, since the page in the iframe comes from another server you cannot
>>read out the document.body.offsetHeight (or, in fact, anything else).
>
>Yes, but the page in iframe can read its own document.body.offsetHeight,
>and call function in parent.
>
>if B's document you then have
>parent.set_iframe_size(document.body.offsetHeight);
>
>and in A you have function
>function set_iframe_size(iframe_height)
>{
> iframe_height += 20;
> document.getElementById('iframe_id').style.height = iframe_height;
>}
>
>I think that should do it.
Nope. Seen from page B, page A is from a different server, and therefore
page B is not allowed to execute any of its functions.
-------------------------------------------------------------------
ppk, freelance web developer
Interaction, copywriting, JavaScript, integration
http://www.quirksmode.org/
Column "Keep it Simple": http://www.digital-web.com/columns/keepitsimple/
------------------------------------------------------------------
_________________________________________________________________
Play online games with your friends with MSN Messenger
http://messenger.msn.nl/
More information about the thelist
mailing list