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

Javascript examples for DOM HTML Element:Area

Description

Area href Property - Change the URL of a link in an area to an absolute URL:

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>/* w  w  w  .  ja va2  s. com*/

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

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

<script>
function myFunction() {
    document.getElementById("myId").href = "http://www.cnn.com";
    document.getElementById("demo").innerHTML = "The link now goes to www.cnn.com.";
}
</script>

</body>
</html>

Related Tutorials