HTML | DOM IFrame name Property
The HTML DOM IFrame name property is used to set or return a value of the name attribute of the Iframe element. The name attribute is used as a reference of the element in JavaScript.
Syntax:
- It return the name property.
iframeObject.name
- It is used to set the name property.
iframeObject.name = name
Property Values:
- name: It is used to specify the name of the Iframe Element.
Return Value: It returns a string value which specify the name of the Iframe element.
Example1: This example illustrates how to return the Iframe name property.
<!DOCTYPE html> <html> <head> <title> HTML DOM iframe name property </title> </head> <body style="text-align:center;"> <h1>GeeksforGeeks</h1> <h2>HTML DOM iframe name Property</h2> id="GFG" height="200" width="400" name="myGeeks"> </iframe> <br><br> <button onclick="Geeks()">Submit</button> <p id="sudo" style="font-size:20px"></p> <script> function Geeks() { var doc_id = document.getElementById("GFG").name; document.getElementById("sudo").innerHTML = doc_id; } </script> </body> </html> |
Output:
Before Clicking on Button:

After Clicking on Button:

Example 2: This example illustrates how to set the Iframe name property.
<!DOCTYPE html> <html> <head> <title> HTML DOM iframe name property </title> </head> <body style="text-align:center;"> <h1>GeeksforGeeks</h1> <h2>HTML DOM iframe name Property</h2> id="GFG" height="200" width="400" name="myGeeks"> </iframe> <br><br> <button onclick="Geeks()">Submit</button> <p id="sudo" style="font-size:20px"></p> <script> function Geeks() { var doc_id = document.getElementById("GFG").name = "sudo"; document.getElementById("sudo").innerHTML = "The value of the name attribute was" + " changed to " + doc_id; } </script> </body> </html> |
Output:
Before Clicking on Button:

After Clicking on Button:

Supported Browsers: The browsers supported by HTML DOM IFrame name property are listed below:
- Google Chrome
- Internet Explorer
- Firefox
- Safari
- Opera
Recommended Posts:
- HTML | DOM IFrame src Property
- HTML | DOM IFrame width Property
- HTML | DOM IFrame height Property
- HTML | DOM IFrame srcdoc Property
- HTML | <iframe> name Attribute
- HTML | <iframe> src Attribute
- HTML | DOM IFrame Object
- HTML | <iframe> marginwidth Attribute
- HTML | <iframe> marginheight Attribute
- HTML | <iframe> scrolling Attribute
- HTML | <iframe> width Attribute
- HTML | <iframe> height Attribute
- HTML | <Iframe> frameborder Attribute
- How to insert HTML content into an iFrame using jQuery?
- What’s the best way to reload / refresh an iframe?
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.



