HTML DOM dir ÊôÐÔ
¶¨ÒåºÍÓ÷¨
dir ÊôÐÔÉèÖûò·µ»ØÔªËصÄÎı¾·½Ïò¡£
Óï·¨
HTMLElementObject.dir=text-direction
ä¯ÀÀÆ÷Ö§³Ö
| IE | Firefox | Chrome | Safari | Opera |
|---|---|---|---|---|
ËùÓÐÖ÷Á÷ä¯ÀÀÆ÷¾ùÖ§³Ö dir ÊôÐÔ¡£
ʵÀý
·µ»Ø body ÔªËØµÄÎı¾·½Ïò£º
<html>
<body id="myid" dir="rtl">
<script>
var 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>