Map name attribute

Definition and usage

name attribute sets or returns the value of the image map name attribute value.

name attribute specifies the name of the image map.

The name attribute with <img> of usemap attribute Associate and create a relationship between the image and the map.

Note:When setting the name attribute, you should also set the usemap attribute of <img> - if not set, the relationship between the image and the map will no longer exist (the clickable area will no longer be clickable).

Note:In HTML5,<map> The id attribute of the element must match name attribute Have the same value (and cannot be null or empty).

Instance

Example 1

Get the name of the image map:

var x = document.getElementById("planetmap").name;

Try it yourself

Example 2

Change the name of the image map:

document.getElementById("planetmap").name = "newMapName";

Try it yourself

Syntax

Return the name attribute:

anchorObject.name

Set the name attribute:

anchorObject.name = name

Attributswert

Wert Beschreibung
name Gibt den Namen der Bildkarte an.

Technische Details

Rückgabewert: Zeichenfolgenwert, der den Namen der Bildkarte angibt.

Browser-Unterstützung

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
Unterstützung Unterstützung Unterstützung Unterstützung Unterstützung

Verwandte Seiten

HTML-Referenzhandbuch:HTML <map> name-Attribut