[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

IFRAME PROBLEM

Posted on 2005-04-20
2
Medium Priority
?
215 Views
Last Modified: 2010-04-09
Iam using an IFRAME inside a table. Iam not using any height attribute for the table <TR><td>.... and I have not mentioned any height attribute for IFRAME also. Inside the IFRAME iam displaying a page. When the page gets displayed intside the IFRAME I get a scroll bar, but I want the IFRAME to get extended instead of having a scroll bar.

Need Solution....
0
Comment
Question by:ramsharma23
2 Comments
 
LVL 32

Accepted Solution

by:
Batalf earned 1500 total points
ID: 13822759
If you don't want to specify any width or height attribute on your iframe, you probably have to resize the <iframe> from the file in the iframe.


Example:

In your main page
<iframe src="page2.html" id="myIframe"></iframe>


and page2.html:

<html>
<head>
    <script>
    function resizeParent(){
        var obj= parent.document.getElementById('myIframe');
        obj.style.width = (document.body.offsetWidth/1 + document.body.scrollWidth/1) + 'px';
        obj.style.height = (document.body.offsetHeight + document.body.scrollHeight/1) + 'px';
       
    }
    </script>
</head>    
<body onload="resizeParent()">
<table width="500" height="500">
    <tr>
        <td><p>Hello</td>
    </tr>
</table>
</body>
</html>
0
 
LVL 33

Expert Comment

by:sajuks
ID: 13822772
//try this
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<script>
function reSize(){
  var fB = window.frames.frm.document.body;
  fB.style.overflow = "hidden";
  window.frames.frm.resizeTo(fB.scrollWidth,fB.scrollHeight)
 
}
</script>
</HEAD>

<BODY>

<iframe src = "c:\1.html" onLoad="reSize()"  name ="frm" id ="frameid"></iframe>
</BODY>
</HTML>
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

This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
Find out what you should include to make the best professional email signature for your organization.
In this tutorial viewers will learn how to style transparent/translucent elements using alpha transparency in CSS Start with a normal styled element, such as a div.: Define its "background-color" property as "rgba (255, 255, 255, .5): The numbers in…
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

872 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