The password property sets or gets the password part of the href attribute value.
Return the password part of the URL for a specific area in an image-map:
var x = document.getElementById("myArea").password;
Click the button to display the password 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" shape="circle" coords="50,50,40" alt="Target" href="https://userName:password123@www.example.com"> </map>//w ww .j a v a 2s. co m <button onclick="myFunction()">Test</button> <p id="demo"></p> <script> function myFunction() { var x = document.getElementById("myArea").password; document.getElementById("demo").innerHTML = x; } </script> </body> </html>