Javascript examples for DOM HTML Element:Anchor
Anchor hreflang Property - Change the language code of a link:
<!DOCTYPE html> <html> <body> <p><a id="myAnchor" hreflang="en-us" href="https://www.java2s.com/">java2s.com</a></p> <button onclick="myFunction()">change the value of the hreflang attribute of the link to "fr"</button> <p id="demo"></p> <script> function myFunction() {//from w ww. java 2s .c o m document.getElementById("myAnchor").hreflang = "fr"; document.getElementById("demo").innerHTML = "The hreflang value of the link was changed from 'en-us' to 'fr'."; } </script> </body> </html>