--- title: Range.startContainer slug: Web/API/Range/startContainer translation_of: Web/API/Range/startContainer ---

 

 

Range.startContainer是只读属性,返回Range开始的节点。要更改节点的起始位置,请使用Range.setStart()方法。

 

Syntax

startRangeNode = range.startContainer;

Example

range = document.createRange();
range.setStart(startNode,startOffset);
range.setEnd(endNode,endOffset);
startRangeNode = range.startContainer;

Specifications

Specification Status Comment
{{SpecName('DOM WHATWG', '#dom-range-startcontainer', 'Range.endContainer')}} {{Spec2('DOM WHATWG')}} No change.
{{SpecName('DOM2 Traversal_Range', 'ranges.html#Level-2-Range-attr-startParent', 'Range.startContainer')}} {{Spec2('DOM2 Traversal_Range')}} Initial specification.

Browser compatibility

{{CompatibilityTable}}

Feature Chrome Edge Firefox (Gecko) Internet Explorer Opera Safari
Basic support {{CompatVersionUnknown}} {{CompatVersionUnknown}} {{CompatGeckoDesktop("1.0")}} 9.0 9.0 {{CompatVersionUnknown}}
Feature Android Edge Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support {{CompatVersionUnknown}} {{CompatVersionUnknown}} {{CompatGeckoMobile("1.0")}} 9.0 9.0 {{CompatVersionUnknown}}

See also