HTML DOM hreflang 属性

定义和用法

The hreflang property sets or returns the base language of the target URL.

语法

linkObject.hreflang=languagecode

实例

The following example returns the language code of the link element:

<html>
<head>
<link rel="stylesheet" type="text/css" 
hreflang="us-en" id="style1" href="try_dom_link.css" />
</head>
<body>

<script type="text/javascript">
x=document.getElementById("style1");
document.write("Language code=" + x.hreflang);
</script>

</body>
</html>