The protocol
property sets or gets the protocol of the href attribute value.
Property Values of protocol
:
Change the protocol part of a specific area in an image-map:
document.getElementById("myArea").protocol = "mailto:";
Click the button to change the protocol 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" shape="circle" coords="50,50,40" alt="Target" href="https://www.java2s.com"> </map>/*from w ww . ja v a2 s . co m*/ <button onclick="myFunction()">Test</button> <p id="demo"></p> <script> function myFunction() { document.getElementById("myArea").protocol = "mailto:"; document.getElementById("demo").innerHTML = "The protocol was changed."; } </script> </body> </html>