Solved

Expandable iFrame depending on child content

Posted on 2006-07-02
3
875 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Article by: DanRollins
This article describes a JavaScript program that creates a maze made of hexagonal cells.  In Part 2 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7850-Hex-Maze-Part-2.html), we'll extend the program by adding a depth-…
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
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…

860 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