Image useMap attribute

Definition and usage

useMap attribute sets or returns the image's usemap attribute value.

The usemap attribute specifies the image as a client-side image map (an image map is an image with clickable areas).

the usemap attribute is associated with map element of name attribute Associate with the image and create a relationship between the image and the map.

Instance

Example 1

Set the useMap attribute:

document.getElementById("planets").useMap = "#planetmap";

Try it yourself

Example 2

Return the usemap attribute value of the image:

var x = document.getElementById("planets").useMap;

Try it yourself

Syntax

Return the useMap attribute:

imageObject.useMap

Set the useMap attribute:

imageObject.useMap = #mapname

attribute value

value description
#mapname Caractère de hachage ("#") suivi du nom de l'élément map à utiliser.

Détails techniques

Valeur de retour : Valeur de chaîne, représentant la valeur de l'attribut usemap de l'image, y compris les caractères de hachage ("#").

Support du navigateur

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
Support Support Support Support Support

Pages associées

Manuel de référence HTML :Propriété usemap de l'élément <img> HTML