HTML DOM dir Property
Definition and Usage
The dir property sets or returns the text-direction for an element.
Syntax
object.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
Want To Be A Web Master?
If you want to be a Web Master, you will have to host your web site with an ISP (Internet Service Provider).
MaximumASP offers seven different configurations of dedicated servers to meet your Windows and .NET hosting needs.
Hosted on our multi-tiered Enterprise Class network, these servers provide the performance, security and reliability
you need to host your high end web sites and applications.
Visit MaximumASP
|