aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/api/range/endoffset/index.html
diff options
context:
space:
mode:
authorPeter Bengtsson <mail@peterbe.com>2020-12-08 14:40:17 -0500
committerPeter Bengtsson <mail@peterbe.com>2020-12-08 14:40:17 -0500
commit33058f2b292b3a581333bdfb21b8f671898c5060 (patch)
tree51c3e392513ec574331b2d3f85c394445ea803c6 /files/zh-cn/web/api/range/endoffset/index.html
parent8b66d724f7caf0157093fb09cfec8fbd0c6ad50a (diff)
downloadtranslated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.gz
translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.bz2
translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.zip
initial commit
Diffstat (limited to 'files/zh-cn/web/api/range/endoffset/index.html')
-rw-r--r--files/zh-cn/web/api/range/endoffset/index.html60
1 files changed, 60 insertions, 0 deletions
diff --git a/files/zh-cn/web/api/range/endoffset/index.html b/files/zh-cn/web/api/range/endoffset/index.html
new file mode 100644
index 0000000000..75b44934a1
--- /dev/null
+++ b/files/zh-cn/web/api/range/endoffset/index.html
@@ -0,0 +1,60 @@
+---
+title: Range.endOffset
+slug: Web/API/Range/endOffset
+tags:
+ - API
+ - DOM
+ - Range
+ - 属性
+translation_of: Web/API/Range/endOffset
+---
+<div>{{ApiRef("DOM")}}</div>
+
+<p><span style="line-height: 1.5;">只读属性</span> <code><strong>Range.endOffset</strong></code> 返回代表<span style="line-height: 1.5;"> </span><code style="font-style: normal; line-height: 1.5;">Range</code><span style="line-height: 1.5;"> 结束位置在 </span>{{domxref("Range.endContainer")}} <span style="line-height: 1.5;">中的偏移值的数字。</span></p>
+
+<p>如果 <code>endContainer</code> 的 {{domxref("Node")}} 类型为 {{domxref("Text")}}, {{domxref("Comment")}},或 {{domxref("CDATASection")}},偏移值是 <code>endContainer</code> 节点开头到 {{domxref("Range")}} 末尾的总字符个数。对其他类型的 {{domxref("Node")}} , <code>endOffset</code> 指 <code>endContainer</code> 开头到 {{domxref("Range")}} 末尾的总 {{domxref("Node")}} 个数。如需修改 <code>endOffset</code> 的值, 使用 {{domxref("Range.setEnd")}} 方法。</p>
+
+<h2 id="Syntax" name="Syntax">语法</h2>
+
+<pre class="syntaxbox"><em>endRangeOffset</em> = <em>range</em>.endOffset;
+</pre>
+
+<h2 id="Example" name="Example">示例</h2>
+
+<pre class="brush:js">var range = document.createRange();
+
+range.setStart(startNode,startOffset);
+range.setEnd(endNode,endOffset);
+endRangeOffset = range.endOffset;</pre>
+
+<h2 id="Specification" name="Specification">规范</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">Specification</th>
+ <th scope="col">Status</th>
+ <th scope="col">Comment</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('DOM WHATWG', '#dom-range-endoffset', 'Range.endOffset')}}</td>
+ <td>{{Spec2('DOM WHATWG')}}</td>
+ <td>No change.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('DOM2 Traversal_Range', 'ranges.html#Level-2-Range-attr-endOffset', 'Range.endOffset')}}</td>
+ <td>{{Spec2('DOM2 Traversal_Range')}}</td>
+ <td>Initial specification.</td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="浏览器兼容性">浏览器兼容性</h2>
+
+<p>{{Compat("api.Range.endOffset")}}</p>
+
+<h2 id="参见">参见</h2>
+
+<ul>
+ <li><a href="/en-US/docs/DOM/DOM_Reference" title="/en-US/docs/DOM/DOM_Reference">The DOM interfaces index</a></li>
+</ul>