Area href Property - Get the URL of a link in an area: - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Area

Description

Area href Property - Get the URL of a link in an area:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<img src="http://java2s.com/resources/a.png" width="145" height="126" usemap="#myMap">

<map name="myMap">
  <area id="myId" shape="circle" coords="125,60,10" alt="Venus" href="venus.htm">
</map>/*from w w w. j  a va2s.  c o m*/

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

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

<script>
function myFunction() {
    var v = document.getElementById("myId").href;
    document.getElementById("demo").innerHTML = v;
}
</script>

</body>
</html>

Related Tutorials