Javascript examples for DOM HTML Element:Area
The protocol property sets or gets the protocol part of the href attribute value.
Set the protocol property with the following Values
Value | Description |
---|---|
protocol | The protocol of a URL: file: ftp: http: https: mailto: etc.. |
A String, representing the protocol part of the URL
The following code shows how to Return the protocol of the URL for a specific area in an image-map:
<!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 ww . ja v a2 s . c o m <button onclick="myFunction()">Test</button> <p id="demo"></p> <script> function myFunction() { var x = document.getElementById("myId").protocol; document.getElementById("demo").innerHTML = x; } </script> </body> </html>