Area password Property - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Area

Description

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

For example: https://myUserName:password123@www.example.com, myUserName is the username and password123 is the password.

Set the password property with the following Values

ValueDescription
password Sets the password part of a URL

Return Value

A String, representing the password part of the URL

The following code shows how to Return the password part of the URL for a specific area in an image-map:

Demo Code

ResultView the demo in separate window

<!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="https://myUserName:password123@www.example.com">
</map>//w ww  .  j av  a 2s  . c o m

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

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

<script>
function myFunction() {
    var v = document.getElementById("myId").password;
    document.getElementById("demo").innerHTML = v;
}
</script>

</body>
</html>

Related Tutorials