selagea
asked on
Resizing iframe height to fit page contents
hello,
is there a way (using javascript or another language), to get my <iframe height=""> to change dynamically as a new page is loaded in it?
I want the iframe height to change dynamically so that i don't have to use another set of scrollbars inside the iframe...
please check this website to see what i mean: http://69.194.150.152/calendar.asp
you can see that the calendar changes while the rest of the page remains the same size... for example, when you press the "view" button, the page changes, yet i want the iframe to be resized so that you don't get a large white space underneath.
----------------------HOW I THINK IT CAN BE DONE---------------------- -----
have a function on the calendar.asp that can change the height of the iframe (in javascript)
then for each page that is loaded in the iframe, it will contain an embedded variable that tells it the height, and calls the function calendar.asp to resize it...
-------------------------- ---------- ---------- ---------- ---------- ---------- --------
Can anyone provide me some code to do this?
thanks very much
is there a way (using javascript or another language), to get my <iframe height=""> to change dynamically as a new page is loaded in it?
I want the iframe height to change dynamically so that i don't have to use another set of scrollbars inside the iframe...
please check this website to see what i mean: http://69.194.150.152/calendar.asp
you can see that the calendar changes while the rest of the page remains the same size... for example, when you press the "view" button, the page changes, yet i want the iframe to be resized so that you don't get a large white space underneath.
----------------------HOW I THINK IT CAN BE DONE----------------------
have a function on the calendar.asp that can change the height of the iframe (in javascript)
then for each page that is loaded in the iframe, it will contain an embedded variable that tells it the height, and calls the function calendar.asp to resize it...
--------------------------
Can anyone provide me some code to do this?
thanks very much
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
thanks you very much, it works perfectly, and is easy to install
Glad we could help. Thanks for the A. :^)
Cd&
Cd&
OOps! wait a minute! There is a problem to this code: Why does the iframe shrink down after browsing many pages?
What about iframed .html pages which contains autoexpanding/compressing menus?
Is there a way in the containing page to dynamically fit the height to the variable source page height?
Is there a way in the containing page to dynamically fit the height to the variable source page height?
in calender.asp:
<iframe name="myiframe" src="iframe.asp"></iframe>
<script type="text/javascript">
function ChangeIframeHeight(NewHeig
{
document.frames.myiframe.s
}
</script>
in iframe.asp:
<body onload="parent.ChangeIfram