Javascript examples for DOM HTML Element:Link
The hreflang property sets or gets the language code of the linked document.
Set the hreflang property with the following Values
Value | Description |
---|---|
languagecode | Sets the language code of the linked document |
A String, representing the language code of the linked document
The following code shows how to return the language code of the linked document:
<!DOCTYPE html> <html> <head> <link id="myLink" href="http://java2s.com" hreflang="ja"> </head>/*from www .j av a 2s.co m*/ <body> <p>Click the button to change the language code of the linked document.</p> <button onclick="myFunction()">Test</button> <p id="demo"></p> <script> function myFunction() { var v = document.getElementById("myLink").hreflang; document.getElementById("demo").innerHTML = v; } </script> </body> </html>