HTML DOM dir แฟ้มค่า

คำอธิบายและการใช้งาน

dir แฟ้มค่าที่ตั้งค่าหรือกลับค่าทิศทางขององค์ประกอบ

รูปแบบ:

object.dir=text-direction

ตัวอย่าง

ตัวอย่างนี้แสดงว่ามีวิธีสองทางเพื่อใช้กำหนดทิศทางของข้อความสำหรับประกายแบบ <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>