The search
property sets or gets the query string of the href attribute value.
The URL query string is after the question mark ?
.
It is used for parameter passing.
Change the query string of the URL for a specific area in an image-map:
document.getElementById("myArea").search = "newValue";
Click the button to change the query string part of the href attribute for the myArea
area in the image-map.
<!DOCTYPE html> <html> <body> <img src="image1.png" width="100" height="100" usemap="#myFlagMap"> <map name="myFlagMap"> <area id="myArea" target="_blank" shape="circle" coords="50,50,40" alt="Target" href="https://www.java2s.com?id=OldValue"> </map>//from w w w.jav a 2 s .c o m <button onclick="myFunction()">Test</button> <p id="demo"></p> <script> function myFunction() { document.getElementById("myArea").search = "newValue"; document.getElementById("demo").innerHTML = "The querystring part was changed."; } </script> </body> </html>