当前位置: 首页 > 网络学院 > 客户端脚本教程 > HTML DOM > HTML DOM lang属性

HTML DOM
DOM TableRow 对象
DOM Textarea 对象
DOM Window 对象

HTML DOM lang属性


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-03-04   浏览: 364 ::
收藏到网摘: n/a

Definition and Usage
定义与用法

The lang property sets or returns the language code for the element.
lang属性可知识后返回元素的语言代码

Syntax
语法

bodyObject.lang=language-code


Example举例

The following example shows two methods on how to get the language code for the <body> element:
下面的举例将使用两种方法来得到<body>标签里的语言代码:

<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


演练

Return the language code for the <body> element
返回<body>元素里代码使用的语言

评论 (0) All

登陆 | 还没注册?