--- title: Selection.collapseToStart() slug: Web/API/Selection/collapseToStart tags: - API - Selection - 参考 - 方法 translation_of: Web/API/Selection/collapseToStart --- <div>{{ ApiRef("DOM") }}{{SeeCompatTable}}</div> <p><strong><code>Selection.collapseToStart()</code></strong> 方法的作用是取消当前选区,并把光标定位在原选区的最开始处,如果此时光标所处的位置是可编辑的,且它获得了焦点,则光标会在原地闪烁。</p> <h2 id="语法">语法</h2> <pre class="syntaxbox"><var><var>sel</var></var>.collapseToStart() </pre> <h3 id="参数">参数</h3> <p><em>无。</em></p> <h2 id="规范">规范</h2> <table class="standard-table"> <tbody> <tr> <th scope="col">规范</th> <th scope="col">状态</th> <th scope="col">备注</th> </tr> <tr> <td>{{SpecName('Selection API', '#dom-selection-collapsetostart', 'Selection.collapseToStart()')}}</td> <td>{{Spec2('Selection API')}}</td> <td>Current</td> </tr> </tbody> </table> <h2 id="浏览器兼容性">浏览器兼容性</h2> <p>{{Compat("api.Selection.collapseToStart")}}</p> <h2 id="参见">参见</h2> <ul> <li>此方法所属的接口,{{domxref("Selection")}}。</li> </ul>