IFrame name attribute
Definition and usage
name
Attribute sets or returns the iframe element in Name attribute Value.
The name attribute specifies the name of the iframe, which can be used to refer to the element in JavaScript, or as the value of these attributes:
- The target attribute of the <a> or <form> elements
- The formtarget attribute of the <input> or <button> elements
Example
Example 1
Get the name of the iframe:
var x = document.getElementById("myFrame").name;
Example 2
Change the name of the iframe:
document.getElementById("myFrame").name = "newIframeName";
Syntax
Return name attribute:
iframeObject.name
Set name attribute:
iframeObject.name = name
Attribute Value
Value | Description |
---|---|
name | The name of the iframe. |
Technical Details
Return Value: | A string value representing the name of the iframe. |
---|
Browser Support
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome | Edge | Firefox | Safari | Opera |
Support | Support | Support | Support | Support |
Related Pages
HTML Reference Manual:HTML <iframe> name Attribute