Javascript examples for DOM HTML Element:Anchor
Anchor username Property - Change the username part of a link:
<!DOCTYPE html> <html> <body> <p><a id="myAnchor" href="https://myUserName:password123@www.example.com">Example link</a></p> <button onclick="myFunction()">change the username part of the link above</button> <p id="demo"></p> <script> function myFunction() {/*w ww . j av a 2 s. c om*/ document.getElementById("myAnchor").username = "newUsername"; document.getElementById("demo").innerHTML = "The username was changed from 'myUserName' to 'newUsername'."; } </script> </body> </html>