Area hostname Property - Change the hostname of a specific area in an image-map: - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Area

Description

Area hostname Property - Change the hostname of a specific area in an image-map:

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" target="_blank" shape="circle" coords="125,60,10" alt="Venus" href="venus.htm#description">
</map>//from w w w  .ja v a  2 s.co  m

<button onclick="myFunction()">change the hostname of the href attribute value for the "myId" area in the image-map</button>

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

<script>
function myFunction() {
    document.getElementById("myId").host = "www.example.com";
    document.getElementById("demo").innerHTML = "The hostname was changed from 'www.java2s.com' to 'www.example.com'.";
}
</script>

</body>
</html>

Related Tutorials