...

View Full Version : iframe script



Jimbo
06-14-2003, 07:13 PM
I need some help with an iframe. I am trying to make a script that changes the height of the iframe to the height of the page within the iframe whenever the page is loaded into it, with no success.
Every page that loads into the iframe has a body onload....


<script language="Javascript" type="text/javascript">
<!--
var content_box = parent.document.getElementbyId("iframe")
-->
</script>
</head>
<body onload="resize_content()"


Now i just need another part of the script that resizes the iframe to the height of the page in the iframe. Any help is greatly appreciated.

Mr J
06-14-2003, 10:02 PM
Please try the following.




Place the script in the page loaded into the Iframe


<script>
function test(){
H=document.body.scrollHeight
W=document.body.scrollWidth
parent.document.getElementById("frame1").height=H
parent.document.getElementById("frame1").width=W
}
</script>

Include

onload="test()"

in the opening BODY tag

Jimbo
06-15-2003, 05:19 AM
Thats all I needed.
The scrollHeight was the key. thanks:)



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum