---
title: Selection.anchorOffset
slug: Web/API/Selection/anchorOffset
translation_of: Web/API/Selection/anchorOffset
---
{{ ApiRef("DOM") }}{{SeeCompatTable}}
只读属性,返回选区的锚节点( {{domxref("Selection.anchorNode")}})起点偏移量的数字。返回值从零开始计数,如果选区从锚节点({{domxref("Selection.anchorNode")}})的第一个字符开始,返回值为0。
语法
number = sel.anchorOffset
规范
Specification |
Status |
Comment |
{{SpecName('HTML Editing', '#dom-selection-anchoroffset', 'Selection.anchorOffset')}} |
{{Spec2('HTML Editing')}} |
Initial definition |
{{SpecName('Selection API', '#widl-Selection-anchorOffset', 'Selection.anchorOffset')}} |
{{Spec2('Selection API')}} |
Current |
浏览器兼容性
{{CompatibilityTable}}
Feature |
Chrome |
Firefox (Gecko) |
Internet Explorer |
Opera |
Safari (WebKit) |
Basic support |
{{CompatUnknown}} |
{{CompatVersionUnknown()}} |
{{CompatUnknown}} |
{{CompatUnknown}} |
{{CompatUnknown}} |
Feature |
Android |
Firefox Mobile (Gecko) |
Firefox OS |
IE Phone |
Opera Mobile |
Safari Mobile |
Basic support |
{{CompatUnknown}} |
{{CompatVersionUnknown()}} |
1.0 |
{{CompatUnknown}} |
{{CompatUnknown}} |
{{CompatUnknown}} |
相关内容
- {{domxref("Selection")}}, the interface it belongs to.