Javascript examples for DOM HTML Element:Anchor
Anchor protocol Property - Change the protocol of a link:
<!DOCTYPE html> <html> <body> <p><a id="myAnchor" href="http://www.example.com/test.htm#part2">Example link</a></p> <button onclick="myFunction()">change the protocol part of the link above</button> <p id="demo"></p> <script> function myFunction() {/*from www .j av a 2s .co m*/ document.getElementById("myAnchor").protocol = "mailto:"; document.getElementById("demo").innerHTML = "The protocol was changed from 'http://' to 'mailto://'."; } </script> </body> </html>