Solved

Expandable iFrame depending on child content

Posted on 2006-07-02
3
865 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 Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Avoid defining the variables in the global scope; trying to define them in a local function scope. Because:   • Look-up is performed every time a variable is accessed.   • Variables are resolved backwards from most specific to least specific scope…
When you need to keep track of a simple list of numbers or strings, the Array object is your most direct tool.  As we saw in my earlier EE Article (http://www.experts-exchange.com/A_3488.html), typical array handling might look like this: (CODE) B…
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…

760 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

23 Experts available now in Live!

Get 1:1 Help Now