how to find out the size(height and width) of frame in iframe

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • pankaj17
    New Member
    • Nov 2008
    • 7

    how to find out the size(height and width) of frame in iframe

    hello,

    I want to find out the height and width of right frame in iframe that is included in left frame.

    main.html
    Code:
    <html>
    <frameset cols="15%, *" id="fs1">
    <frame src="left.html" name="left" frameborder="1" id=leftId >
    <frame src="right.html" name="right" frameborder="1" id=rightId>
    </frameset>
    </html>
    suppose in left frame i have included a iframe and in that iframe code i want to find out the size of right frame.

    left.html
    Code:
    <html>
    <head>
    </head>
    <body>
    <iframe src ="iframe_test.html" width="100%" height="300px">
    </iframe>
    </body>
    </html>
    right.html page could be any html page.

    iframe_test.htm l
    Code:
    <html>
    <head>
    <script>
    // Here i want to find out the height and width of right frame 
    </script>
    </head>
    </html>
  • Nicodemas
    Recognized Expert New Member
    • Nov 2007
    • 164

    #2
    try this:

    Code:
    var frameR = window.frames[1].contentDocument;
    
    var frameR_w = frameR.width ? frameR.width : frameR.documentElement.offsetWidth;
    
    var frameR_h = frameR.height ? frameR.height : frameR.documentElement.offsetHeight;

    Comment

    Working...