aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/api/range/startoffset
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/startoffset
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/startoffset')
-rw-r--r--files/zh-cn/web/api/range/startoffset/index.html64
1 files changed, 64 insertions, 0 deletions
diff --git a/files/zh-cn/web/api/range/startoffset/index.html b/files/zh-cn/web/api/range/startoffset/index.html
new file mode 100644
index 0000000000..54cf5b8372
--- /dev/null
+++ b/files/zh-cn/web/api/range/startoffset/index.html
@@ -0,0 +1,64 @@
+---
+title: Range.startOffset
+slug: Web/API/Range/startOffset
+tags:
+ - API
+ - DOM
+ - Range
+ - 属性
+translation_of: Web/API/Range/startOffset
+---
+<p>{{ ApiRef("Range") }}</p>
+
+<p><code><strong>Range.startOffset</strong></code> <span style="line-height: 1.5;">是一个只读属性,</span>用于返回一个表示<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><code style="font-style: normal; line-height: 1.5;">startContainer</code><span style="line-height: 1.5;"> 中的起始位置的数字。</span></p>
+
+<p>如果 <code>startContainer</code> 是一个文本({{domxref("Text")}})、注释({{domxref("Comment")}})或者CDATA区块({{domxref("CDATASection")}})节点,那么返回的偏移量是从<span style="line-height: 1.5;"> </span><code style="font-style: normal; line-height: 1.5;">startContainer</code><span style="line-height: 1.5;"> 开始到 </span><span style="line-height: 1.5;">{{domxref("Range")}} 的</span><span style="line-height: 1.5;">边界点的字符数量</span><span style="line-height: 1.5;">。对于其他的节点类型,</span><span style="line-height: 1.5;"> </span><code style="font-style: normal; line-height: 1.5;">startOffset</code><span style="line-height: 1.5;"> 返回</span><span style="line-height: 1.5;"> </span><code style="font-style: normal; line-height: 1.5;">startContainer</code><span style="line-height: 1.5;"> 到边界点的子节点数量。</span></p>
+
+<p><span style="line-height: 1.5;">可使用{{domxref("Range.setStart")}} 方法</span>改变<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>的<span style="line-height: 1.5;"> </span><code style="font-style: normal; line-height: 1.5;">startOffset</code><span style="line-height: 1.5;"> 位置。</span></p>
+
+<h2 id="Syntax" name="Syntax">语法</h2>
+
+<pre class="syntaxbox"><em>startRangeOffset</em> = <em>range</em>.startOffset;
+</pre>
+
+<h2 id="Example" name="Example">示例</h2>
+
+<pre class="brush: js">range = document.createRange();
+range.setStart(startNode,startOffset);
+range.setEnd(endNode,endOffset);
+startRangeOffset = range.startOffset;
+</pre>
+
+<h2 id="Specification" name="Specification">规范</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">规范</th>
+ <th scope="col">状态</th>
+ <th scope="col">注释</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('DOM WHATWG', '#dom-range-startoffset', 'Range.startOffset')}}</td>
+ <td>{{Spec2('DOM WHATWG')}}</td>
+ <td>无变化</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('DOM2 Traversal_Range', 'ranges.html#Level-2-Range-attr-startOffset', 'Range.startOffset')}}</td>
+ <td>{{Spec2('DOM2 Traversal_Range')}}</td>
+ <td>初始规范</td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="浏览器兼容性">浏览器兼容性</h2>
+
+<p>{{Compat("api.Range.startOffset")}}</p>
+
+<h2 id="参见">参见</h2>
+
+<div id="compat-mobile"></div>
+
+<ul>
+ <li><a href="/en-US/docs/DOM/DOM_Reference" title="/en-US/docs/DOM/DOM_Reference">The DOM interfaces index</a></li>
+</ul>