Map name Property - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Map


The name property sets or gets the name attribute of an image-map.

Set the name property with the following Values

Value Description
name Sets the name of an image-map

Return Value

A String, representing the name of the image-map

The following code shows how to get the name of an image-map:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>

<img src="" width="145" height="126" alt="alt message" usemap="#myMap">

<map id="myMap" name="myMap">
  <area shape="rect" coords="0,0,82,110" alt="rect" href="">
  <area shape="circle" coords="90,60,5" alt="circle1" href="">
  <area shape="circle" coords="125,60,10" alt="circle2" href="">
</map>/*  w w  w . j a va  2 s . com*/

<button onclick="myFunction()">Test</button>

<p id="demo"></p>

function myFunction() {
    var v = document.getElementById("myMap").name;
    document.getElementById("demo").innerHTML = v;


Related Tutorials