HTML DOM dir Property
Complete Body Object Reference
Definition and Usage
The dir property sets or returns the direction of text for the element.
Syntax
bodyObject.dir=text-direction
|
Example
The following example shows two methods on how to get the text direction for the <body>
element:
<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>
|
Output:
Text direction: rtl
An alternate way: rtl
|
Try-It-Yourself Demos
Return the
text direction for the <body> element
Complete Body Object Reference
|
|
|
See why there are 20,000+ Ektron integrations worldwide.
Request an INSTANT DEMO or download a FREE TRIAL today. |
|
|
|