Link hreflang Property - Change the language code of the linked document: - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Link

Description

Link hreflang Property - Change the language code of the linked document:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<head>
<link id="myLink" href="http://java2s.com" hreflang="ja">
</head>/*from  w  w w.  j  a va2 s.c o m*/
<body>

<button onclick="myFunction()">Test</button>

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

<script>
function myFunction() {
    document.getElementById("myLink").hreflang = "en-us";
    document.getElementById("demo").innerHTML = "The language code was changed from 'ja' to 'en-us'.";
}
</script>

</body>
</html>

Related Tutorials