Anchor password Property - Change the password part of a link: - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Anchor

Description

Anchor password Property - Change the password part of a link:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<p><a id="myAnchor" href="https://myUserName:password123@www.example.com">Example link</a></p>

<button onclick="myFunction()">change the password part of the link above</button>

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

<script>
function myFunction() {// w w  w  . jav  a2s  .c o  m
    document.getElementById("myAnchor").password = "newPassword101";
    document.getElementById("demo").innerHTML = "The password was changed from 'password123' to 'newPassword101'.";
}
</script>

</body>
</html>

Related Tutorials