JavaScript Reference/Javascript Properties/dir
"dir" Example
<html>
<body>
<script language="JavaScript">
function function1() {
document.all.myP.dir = "rtl";
}
</script>
<p id="myP" onload="function1();">ARABIC OR HEBREW IN TEXT THIS</p>
</body>
</html>
"dir" is applied to
+----------------+--------------------------------------------------------------+
| Applied_To |<a> <acronym> |
| |<address> <applet> |
| |<area> <b> |
| |<base> <basefont> |
| |<bdo> <big> |
| |<blockquote> <body> |
| |<br> <button> |
| |<caption> <center> |
| |<cite> <code> |
| |<col> <colgroup> |
| |<custom> <dd> |
| |<del> <dfn> |
| |<dir> <div> |
| |<dl> document |
| |<dt> <em> |
| |<embed> <fieldset> |
| |<font> <form> |
| |<frame> <frameset> |
| |<head> <hn> |
| |<hr> <html> |
| |<i> <iframe> |
| |<img> <input type="button"> |
| |<input type="checkbox"> <input type="file"> |
| |<input type="image"> <input type="password"> |
| |<input type="radio"> <input type="reset"> |
| |<input type="submit"> <input type="text"> |
| |<ins> <isindex> |
| |<kbd> <label> |
| |<legend> <li> |
| |<link> <listing> |
| |<map> <marquee> |
| |<menu> <meta> |
| |<nobr> <noframes> |
| |<noscript> <object> |
| |<ol> <optgroup> |
| |<option> <p> |
| |<param> <plaintext> |
| |<pre> <q> |
| |<rt> <ruby> |
| |<s> <samp> |
| |<script> <select> |
| |<small> <span> |
| |<strike> <strong> |
| |<style> <sub> |
| |<sup> <table> |
| |<tbody> <td> |
| |<textarea> <tfoot> |
| |<th> <thead> |
| |<title> <tr> |
| |<tt> <u> |
| |<ul> <var> |
| |<xmp> |
+----------------+--------------------------------------------------------------+
"dir" Possible Values
Possible Values
ltr left to right
rtl right to left
"dir" Syntax and Note
Note:
Read and write property.
Sets the text reading order.
The property does not affect alphanumeric characters in Latin documents.
Syntax:
document.getElementById("elementID").dir = value
document.all.elementID.dir = value // IE only