Area search Property - Change the query string of the URL for a specific area in an image-map: - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Area

Description

Area search Property - Change the query string of the URL for 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?id=searchtest">
</map>//from   w  w  w  .  java  2s  .  com

<button onclick="myFunction()">change the querystring part of the href attribute</button>

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

<script>
function myFunction() {
    document.getElementById("myId").search = "somenewsearchvalue";
    document.getElementById("demo").innerHTML = "The querystring part was changed from 'searchtest' to 'somenewsearchvalue'.";
}
</script>

</body>
</html>

Related Tutorials