Wednesday, September 25, 2024
Google search engine
HomeLanguagesJavascriptHTML DOM Window frames Properties

HTML DOM Window frames Properties

The HTML DOM Window frames property in HTML DOM is used to return the frame element in the form of an array object. This property represents all <iframe> elements in the current window. DOM Windowframe is a read-only property. 

Syntax:

window.frames

Properties:

Return Value: It returns a reference to the Window object, representing all the frames in the current window. 

Example 1: In this example, we will see the number of iframe elements in the current window using window.length property.

HTML




</iframe><br>
  
<p>
    Click on the button to display
    the number of iframes
</p>
  
<button onclick="myGeeks()">
    Click Here!
</button>
  
<p id="GFG"></p>
  
<!-- script to count iframes -->
<script>
    function myGeeks() {
        var x = window.length;
        document.getElementById("GFG").innerHTML = x;
    }
</script>


Output: 

 

Example 2: In this example, we will see the usage of window.frame[] property.

HTML




</iframe><br>
<p>
    Click on the button to change
    the location of iframe element
</p>
  
<button onclick="myGeeks()">
    Click Here!
</button>
  
<p id="GFG"></p>
  
<!-- script to count iframes -->
<script>
    function myGeeks() {
        window.frames[0].location =
    }
</script>


Output: 

 

Supported Browsers: The browser supported by DOM Window Frames Property are listed below:

  • Google Chrome 1 and above
  • Edge 12 and above
  • Internet Explorer 4 and above
  • Firefox 1 and above
  • Opera 12.1 and above
  • Safari 1 and above

We have a Cheat Sheet on Javascript where we covered all the important topics of Javascript to check those please go through Javascript Cheat Sheet-A Basic guide to JavaScript.

Whether you’re preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, neveropen Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we’ve already empowered, and we’re here to do the same for you. Don’t miss out – check it out now!

RELATED ARTICLES

Most Popular

Recent Comments