ویژگی dir HTML DOM

تعریف و استفاده

ویژگی dir تنظیم یا بازگشت جهت نوشتن عناصر.

نحوه استفاده:

object.dir=text-direction

مثال

این مثال دو روش برای دریافت جهت نوشتن متن در عناصر <body> را نشان می‌دهد:

<html>
<body id="myid" dir="rtl">
<script type="text/javascript">
x=document.getElementsByTagName('body')[0];
document.write("جهت نوشتن متن: " + x.dir);
document.write("<br />");
document.write("یک راه دیگر: ");
document.write(document.getElementById('myid').dir);
</script>
</body>
</html>