Example
Get the name of an iframe:
var x = document.getElementById("myFrame").name;
The result of x will be:
iframe_a
Try it Yourself »
Definition and Usage
The name property sets or returns the value of the name attribute in an iframe element.
The name attribute specifies the name of an iframe, and can be used to reference the element in a JavaScript, or as the value of the target attribute of an <a> or <form> element, or the formtarget attribute of an <input> or <button> element.
Browser Support
Property | |||||
---|---|---|---|---|---|
name | Yes | Yes | Yes | Yes | Yes |
Syntax
Return the name property:
iframeObject.name
Set the name property:
iframeObject.name=name
Property Values
Value | Description |
---|---|
name | The name of the iframe |
Technical Details
Return Value: | A String, representing the name of the iframe |
---|
More Examples
Example
Change the name of an iframe:
document.getElementById("myFrame").name = "newIframeName";
Try it Yourself »
Related Pages
HTML reference: HTML <iframe> name attribute
< IFrame Object