HTML DOM dir 屬性
定義和用法
dir 屬性設(shè)置或返回元素的文字方向。
語法:
object.dir=text-direction
實(shí)例
本例展示了兩種獲取 <body> 元素的文本方向的方法:
<html>
<body id="myid" dir="rtl">
<script type="text/javascript">
x=document.getElementsByTagName('body')[0];
document.write("Text direction: " + x.dir);
document.write("<br />");
document.write("An alternate way: ");
document.write(document.getElementById('myid').dir);
</script>
</body>
</html>