Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    May 2005
    Posts
    33
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Changing IFRAME height in Mozilla & FF

    Hi All,

    I'm loading a DIV element over an IFRAME, the DIV element contains a table in which I'm dynamically creating table rows. The DIV element height icreases on dynamic row creation, simultaneously the IFRAME height has to be increased to the DIV element height. I tried the following code,

    Code:
    document.getElementById('testIframe').style.height = document.getElementById('testDiv').offsetHeight;
    it works well in IE & Opera but not in Mozilla & FireFox.

    How to increase IFRAME height dynamically as I said above in Mozilla & FireFox.
    Thanks & Regards,
    Srikanth S

  • #2
    Senior Coder
    Join Date
    Mar 2005
    Location
    Portsmouth UK
    Posts
    4,513
    Thanks
    3
    Thanked 504 Times in 491 Posts
    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    
    
    <head>
      <title></title>
    </head>
    
    <body>
    <iframe id="fred" src="a.htm" width="800" height="100"></iframe>
    </body>
    
    </html>
    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    
    
    <head>
      <title>a.htm</title>
    <script language="JavaScript" type="text/javascript">
    <!--
    function Cng(){
     if (window.parent.document.getElementById('fred')){
      window.parent.document.getElementById('fred').style.height='300px';
    
     }
    
    }
    //-->
    </script>
    </head>
    
    <body>
    <div style="width:100px;height:100px;background-color:red;"
    onclick="this.style.height='200px';Cng();"
    
    ></div>
    </body>
    
    </html>
    Vic

    God Loves You and will never love you less.

    http://www.vicsjavascripts.org/Home.htm

    If my post has been useful please donate to http://www.operationsmile.org.uk/


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •