Solved

Expandable iFrame depending on child content

Posted on 2006-07-02
3
868 Views
Last Modified: 2008-01-09
Hi X-perts,

I am trying to find the best solution for an expandable iFrame, which height depends on the child's page height. The child page is from my site also. I am using currently this code:

<a href="page1.php" target="details">
<span id="visSpan">Wait</span>
<iframe id="details" name="details" width="495" frameborder="0" align="top" marginwidth="0" marginheight="0" scrolling="no" onload="visSpan.innerHTML=details.document.body.innerHTML" style="display:none"></iframe>

I am having problems with flash objects on the child page - see my post http://www.experts-exchange.com/Web/Web_Languages/JavaScript/Q_21906072.html

Are there any better JScript solutions for the resizable iFrames? I believe, Zvonko has written a similar script, but I cannot find the complete code.

Thanks

-A-
0
Comment
Question by:andy7789
  • 2
3 Comments
 
LVL 63

Accepted Solution

by:
Zvonko earned 500 total points
ID: 17031054
How about this:

<script>
function reSize(theIframe){
  var fName = theIframe.name;
  window.frames[fName].frameElement.style.height=window.frames[fName].document.body.scrollHeight;
}
</script>
<body>
<a href="page1.htm" target="details">Page One</a><br>
<iframe id="details" name="details" width="495" frameborder="0" align="top" marginwidth="0" marginheight="0" scrolling="no" onload="reSize(this)" ></iframe>

</body>

0
 

Author Comment

by:andy7789
ID: 17034492
Works just as good as it could be! Thanks!
0
 
LVL 63

Expert Comment

by:Zvonko
ID: 17035996
You are welcome.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In my daily work (mainly using ASP.net), I need to write a lot of JavaScript code. One of the most repetitive tasks I do are the jQuery Ajax calls. You know: (CODE) I don't know if for you it's the same, but for me is soooo tedious to write the …
This article will give core knowledge of JavaScript and will head in to your first JavaScript program. I am Durvesh Naik and I am here to deal with this series of JavaScript. I will teach you JavaScript in part wise , as its quite boring to read big…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now