Atur dir DOM HTML

Definisi dan Penggunaan

Atur atau kembalikan arah teks elemen.

Syarat:

object.dir=text-direction

Contoh

Contoh ini menunjukkan dua cara untuk mendapatkan arah teks elemen <body>:

<html>
<body id="myid" dir="rtl">
<script type="text/javascript">
x=document.getElementsByTagName('body')[0];
document.write("Arah Teks: "); x.dir);
document.write("<br />");
document.write("Sebuah cara alternatif: ");
document.write(document.getElementById('myid').dir);
</script>
</body>
</html>