English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

HTML Reference Manual

HTML Tag大全

HTML: <iframe> name attribute

This article introduces how to specify the name of <iframe> using the HTML iframe name attribute. This name attribute can be used to reference elements in JavaScript, or as the value of the target attribute of <a> or <form> elements, or as the value of the formtarget attribute of <input> or <button> elements.

 HTML <iframe> tag

Online Example

The name is used as the link target <iframe>:

<!DOCTYPE html>
<html>
<head>
<title>HTML:<iframe> name attribute - Basic Tutorial Website oldtoolbag.com</title>
<body>
<iframe src="demo-iframe.html" name="iframe_a">
<p>Your browser does not support iframe</p>
</iframe>
<a href="//www.oldtoolbag.com" target="iframe_a">oldtoolbag.com</a>
<p>Notice: Since the link target matches the iframe name, the link will open in the iframe.</p>
</body>
</html>
Test See ‹/›

Browser Compatibility

IEFirefoxOperaChromeSafari

All major browsers support the name attribute.

Definition and Usage

The name attribute specifies the name of the <iframe>.
This name attribute can be used to reference elements in JavaScript, or as the value of the target attribute of an <a> or <form> element, or as the formtarget attribute value of an <input> or <button> element.

HTML 4.01 Compared to HTML5Differences

None.

HTML 4.01 Differences Between

In XHTML, it is not recommended to use the name attribute, as it has been removed. Please use the id attribute instead.

Syntax

<iframe name="name">

Attribute Value

ValueDescription
nameSpecify the name of the <iframe>.
 HTML <iframe> tag