Javascript DOM HTML Area password Property set

Introduction

The password property sets or gets the password part of the href attribute value.

Change the password part of a specific area in an image-map:

document.getElementById("myArea").password = "newPassword101";

Click the button to change the password part of the href attribute for the myArea area in the image-map.

View in separate window

<!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>/*from   ww w  . ja v a  2s.  c  o m*/

<button onclick="myFunction()">Test</button>

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

<script>
function myFunction() {
  document.getElementById("myArea").password = "newPassword101";
  document.getElementById("demo").innerHTML = "The password was changed.";
}
</script>

</body>
</html>



PreviousNext

Related