HTML | DOM IFrame height Property

The HTML DOM IFrame height Property is used to sets or returns the value of the height attribute of an Iframe Element. The height attribute is used to specify the width of an Iframe Element.

Syntax:

  • It return the height Property.
    iframeObject.height
  • It is used to set the height property.
    iframeObject.height = pixels

Property Values:

  • pixels: It specifies the height of the Iframe Element in terms of pixels

Return Value It returns a string value which represents the height of the Iframe in terms of pixels.

Example-1: This Example illustrates how to return the Iframe height Property.

filter_none

edit
close

play_arrow

link
brightness_4
code

<!DOCTYPE html>
<html>
  
<head>
    <title>
        HTML DOM iframe height Property
    </title>
</head>
  
<body style="text-align:center;">
  
    <h1>GeeksforGeeks</h1>
  
    <h2>HTML DOM iframe height Property</h2>
  
    <iframe src=
            id="GFG" 
            height="200"
            width="400">
  </iframe>
    <br>
    <br>
    <button onclick="Geeks()">Submit</button>
    <p id="sudo" style="font-size:20px"></p>
    <script>
        function Geeks() {
            var x =
                document.getElementById("GFG").height;
            document.getElementById("sudo").innerHTML = x;
  
        }
    </script>
  
</body>
  
</html>

chevron_right


Output:

Before Clicking On Button:

After Clicking On Button:

Example-2: This Example illustrates how to set the Iframe height Property.

filter_none

edit
close

play_arrow

link
brightness_4
code

<!DOCTYPE html>
<html>
  
<head>
    <title>
        HTML DOM iframe height Property
    </title>
</head>
  
<body style="text-align:center;">
  
    <h1>GeeksforGeeks</h1>
  
    <h2>HTML DOM iframe height Property</h2>
  
    <iframe src=
            id="GFG"
            height="200" 
            width="400">
  </iframe>
    <br>
    <br>
    <button onclick="Geeks()">Submit</button>
    <p id="sudo" style="font-size:20px"></p>
    <script>
        function Geeks() {
            var x = 
                document.getElementById("GFG").height = 
                "400";
            document.getElementById("sudo").innerHTML = x;
  
        }
    </script>
  
</body>
  
</html>

chevron_right


Output:
Before Clicking On Button:

After Clicking On Button:

Supported Browsers: The browsers supported by HTML DOM IFrame height Property are listed below:

  • Google Chrome
  • Internet Explorer
  • Firefox
  • Apple Safari
  • Opera


My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.




Article Tags :
Practice Tags :


Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.