aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/api/selection/selectallchildren/index.html
blob: eae930d887c9b0d16bbc5e73771a81bbc4fc28ce (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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
---
title: Selection.selectAllChildren()
slug: Web/API/Selection/selectAllChildren
translation_of: Web/API/Selection/selectAllChildren
---
<div>
<div>
<div>{{ ApiRef("DOM") }}{{SeeCompatTable}}</div>
</div>
</div>

<p>Selection.selectAllChildren()把指定元素的所有子元素设为选中区域,并取消之前的选中区域。</p>

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

<pre class="syntaxbox"><em>sel</em>.selectAllChildren(<em>parentNode</em>)
</pre>

<h3 id="Parameters" name="Parameters">参数</h3>

<dl>
 <dt><em><code>parentNode</code></em></dt>
 <dd>所有parentNode元素的子元素会被设为选中区域,parentNode本身除外。</dd>
</dl>

<h2 id="Examples" name="Examples">举例</h2>

<pre class="eval">footer = document.getElementById("footer");
window.getSelection().selectAllChildren(footer);
/* Everything inside the footer is now selected *</pre>

<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-selectallchildren', 'Selection.selectAllChildren()')}}</td>
   <td>{{Spec2('HTML Editing')}}</td>
   <td>Initial definition</td>
  </tr>
  <tr>
   <td>{{SpecName('Selection API', '#widl-Selection-selectAllChildren-void-Node-node', 'Selection.selectAllChildren()')}}</td>
   <td>{{Spec2('Selection API')}}</td>
   <td>Current</td>
  </tr>
 </tbody>
</table>

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

<div id="compat-desktop">
<p>{{Compat("api.Selection.selectAllChildren")}}</p>
</div>

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

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