blob: 59b673a6fdeb6921348ff5b5c0596724fb05f917 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
---
title: Document.dir
slug: Web/API/Document/dir
translation_of: Web/API/Document/dir
---
<p>{{ApiRef("")}}</p>
<p>Document.dir的本质是DOMString,代表了文档的文字朝向,是从左到右(默认)还是从右到左。</p>
<p>'rtl'(right to left)代表从右到左,'ltr'(left to right)代表从左到右。</p>
<h2 id="语法">语法</h2>
<pre class="syntaxbox">console.log(document.dir);// "" (译者添加)
document.dir = "ltr"//(默认);
document.dir = "rtl";
<em>dirStr</em> = <em>document.</em>dir;
<em>document.dir</em> = <em>dirStr;</em>
</pre>
<p>(译者注:第一次调用该属性时,可能返回空字符串"",译者环境:chrome,版本 53.0.2785.116 m)</p>
<h2 id="Specifications" name="Specifications">说明</h2>
<table class="standard-table">
<thead>
<tr>
<th scope="col">规范</th>
<th scope="col">状态</th>
<th scope="col">评论</th>
</tr>
</thead>
<tbody>
<tr>
<td>{{SpecName("HTML WHATWG", "dom.html#the-dir-attribute:dom-dir", "Document.dir")}}</td>
<td>{{Spec2("HTML WHATWG")}}</td>
<td>Initial specification</td>
</tr>
</tbody>
</table>
<h2 id="浏览器兼容性">浏览器兼容性</h2>
{{Compat("api.Document.dir")}}
<h2 id="参见">参见</h2>
<ul>
<li><a class="external" href="http://msdn.microsoft.com/en-us/library/ms533731.aspx" rel="freelink">http://msdn.microsoft.com/en-us/library/ms533731.aspx</a></li>
</ul>
|