Get Area Element - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Area


The Area object represents an HTML <area> element.

You can access an <area> element by using getElementById():

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>

<img src="" width="100" height="100" usemap="#planetmap">

<map name="planetmap">
  <area id="myArea" shape="circle" coords="120,50,10" alt="alt message" href="">
</map>/*from w  w  w.  j  a  v a 2  s . c om*/

<button onclick="myFunction()">get the URL of the area</button>

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

function myFunction() {
    var x = document.getElementById("myArea").href;
    document.getElementById("demo").innerHTML = x;


Related Tutorials