--- title: Selection.anchorOffset slug: Web/API/Selection/anchorOffset translation_of: Web/API/Selection/anchorOffset ---
只读属性,返回选区的锚节点( {{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 |