HTML DOM lang Property
Definition and Usage
The lang property sets or returns the language code for an element.
Syntax
object.lang=language-code
|
Example
The following example shows two methods on how to get the language code for the <body>
element:
<html>
<body id="myid" lang="en-us">
<script type="text/javascript">
x=document.getElementsByTagName('body')[0];
document.write("Body language: " + x.lang);
document.write("<br />");
document.write("An alternate way: ");
document.write(document.getElementById('myid').lang);
</script>
</body>
</html>
|
Output:
Body language: en-us
An alternate way: en-us
|
Try-It-Yourself Demos
Return the
language code for the <body> element
 |

|
|
See why there are 20,000+ Ektron integrations worldwide.
Request an INSTANT DEMO or download a FREE TRIAL today. |
|
|
|