THE WORLD'S LARGEST WEB DEVELOPER SITE
HTMLCSSJAVASCRIPTSQLPHPBOOTSTRAPJQUERYANGULARXML
 

IFrame name Property

IFrame Object Reference IFrame Object

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

Internet Explorer Firefox Opera Google Chrome Safari

The name property is supported in all major browsers.


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 Reference IFrame Object