Solved

Expandable iFrame depending on child content

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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Javascript to set controls visibility 5 38
Checking data with javascript 3 19
jQuery - following an example but can I save data server side? 20 50
Jquery 10 20
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 …
The task A number given should be formatted for easy reading by separating digits into triads. Format must be made inline via JavaScript, i.e., frameworks / functions are not welcome. So let’s take a number like this “12345678.91¿ and format i…
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…

803 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