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....
Who is Participating?
BatalfConnect With a Mentor Commented:
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.


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

and page2.html:

    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';
<body onload="resizeParent()">
<table width="500" height="500">
//try this
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
function reSize(){
  var fB = window.frames.frm.document.body;
  fB.style.overflow = "hidden";


<iframe src = "c:\1.html" onLoad="reSize()"  name ="frm" id ="frameid"></iframe>
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.