aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/api/selection/anchornode/index.html
blob: b3a2211e77397da7b1e7d094f1675fd9e0ce8908 (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: Selection.anchorNode
slug: Web/API/Selection/anchorNode
translation_of: Web/API/Selection/anchorNode
---
<div>{{ApiRef}}</div>

<h2 id="Summary" name="Summary">概述</h2>

<p><strong><code>Selection.anchorNode </code></strong><code>只读属性</code>返回选区开始位置所属的节点({{domxref("Node")}})。</p>

<h2 id="Syntax" name="Syntax">用法</h2>

<pre class="syntaxbox"><em>sel</em>.anchorNode</pre>

<h2 id="Notes" name="Notes">注意</h2>

<p>用户可能从左至右进行框选(沿着文字顺序)或者从右至左框选(沿着文字顺序的反方向)。锚点位于用户开始选择的位置。可以通过按住Shift和方向键来得知锚点所在的位置。选区的锚点是不会移动的,但是选区的焦点、选区其他的结束位置(多个选区,译者注)可以移动。</p>

<h2 id="说明">说明</h2>

<table class="standard-table">
 <tbody>
  <tr>
   <th scope="col">说明</th>
   <th scope="col">状态</th>
   <th scope="col">注释</th>
  </tr>
  <tr>
   <td>{{SpecName('HTML Editing', '#dom-selection-anchornode', 'Selection.anchorNode')}}</td>
   <td>{{Spec2('HTML Editing')}}</td>
   <td>Initial definition</td>
  </tr>
  <tr>
   <td>{{SpecName('Selection API', '##widl-Selection-anchorNode', 'Selection.anchorNode')}}</td>
   <td>{{Spec2('Selection API')}}</td>
   <td>Current</td>
  </tr>
 </tbody>
</table>

<h2 id="Browser_compatibility" name="Browser_compatibility">浏览器兼容性</h2>

{{Compat("api.Selection.anchorNode")}}

<h2 id="See_also" name="See_also">相关链接</h2>

<ul>
 <li>{{domxref("Selection")}}, 此属性所属接口。</li>
</ul>