?
Solved

How to increase the size of an iframe based on its content

Posted on 2003-11-18
4
Medium Priority
?
525 Views
Last Modified: 2008-02-01
Hii Friends,
i want to increase the size of iframe based on its source provided in the src attribute.
i have code like this
<table>
<tr>
<td>page Header</td></tr>
<tr><td><ifame src="yahoo.com" >
</td><tr>
<tr>
<td>page Header</td></tr>
</table>

when i access this kind of page i got scrollbar in iframe .
but i don't want this scrollbar and if hardcode the width and height of iframe like the code given below

<table>
<tr>
<td>page Header</td></tr>
<tr><td><ifame src="yahoo.com"  width="300" height="1000">
</td><tr>
<tr>
<td>page Header</td></tr>
</table>

then some part of ifrmae remains blank i don't want this kind of behavior.
so my aim is to adjust the width and height of iframe to the src height and width how i can do this ..
thanks to all of u in advance.

0
Comment
Question by:happymanocha
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 4

Accepted Solution

by:
apprenti earned 300 total points
ID: 9779639
This is the parent document:
...
<table>
<tr>
<td>page Header</td></tr>
<tr><td><iframe id="miframe" src="tpage1.htm" ></iframe>
</td><tr>
<tr>
<td>page Header</td></tr>
</table>
...

-----------------------------------------
This is a document in the iframe -- tpage1.htm

<html><body id="b1">
hello<br />
hello<br />
<script>
<!--
f=document.getElementById('b1').offsetHeight
// alert(f)
parent.document.getElementById('miframe').setAttribute('height',f)
// -->
</script>
</body></html>

You would need to style up the iframe etc and make f=f+40 or whatever
0
 
LVL 2

Expert Comment

by:TGHI
ID: 9783398
 Maybe I'm just trying to get a cheap way out of this - but if you're upset about scrollbars showing up in your iframe, you could always take the overflow off with CSS.

    <style type= text/css>
       body {overflow: hidden}
    </style>

  Putting this code in the document within the iframe will eliminate scrollbars - but it will also cut off anything that would normally be viewed through scrolling.  I'm not really sure if that will help you or not....


        TGHI
0
 
LVL 16

Expert Comment

by:jaysolomon
ID: 10383002
No comment has been added lately, so it's time to clean up this TA.
I will leave the following recommendation for this question in the Cleanup topic area:

Accept: apprenti {http:#9779639}

Please leave any comments here within the next four days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

jAy
EE Cleanup Volunteer
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

In Part 1 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7849-Hex-Maze.html) we covered the hexagonal maze basics -- how the cells are represented in a JavaScript array and how the maze is displayed.  In this part, we'…
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…
Suggested Courses

762 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