Please note, this is a STATIC archive of website developer.mozilla.org from November 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

Selection.deleteFromDocument()

翻译正在进行中。

这是一个实验中的功能
此功能某些浏览器尚在开发中,请参考浏览器兼容性表格以得到在不同浏览器中适合使用的前缀。由于该功能对应的标准文档可能被重新修订,所以在未来版本的浏览器中该功能的语法和行为可能随之改变。

The Selection.deleteFromDocument() method deletes the actual text being represented by a selection object from the document's DOM.

Syntax

sel.deleteFromDocument()

Parameters

None.

Examples

A user selects the (imaginary) text "ve two ea" from "Rabbits have two ears." on a web page. The user then clicks a button that executes the JavaScript snippet window.getSelection().deleteFromDocument(). The document's text becomes "Rabbits hars."

Specifications

Specification Status Comment
HTML Editing APIs
Selection.deleteFromDocument()
Editor's Draft Initial definition
Selection API
Selection.deleteFromDocument()
Working Draft Current

Browser compatibility

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support ? (Yes) ? ? ?
Feature Android Firefox Mobile (Gecko) Firefox OS IE Phone Opera Mobile Safari Mobile
Basic support ? (Yes) 1.0 ? ? ?

See also

文档标签和贡献者

 此页面的贡献者: FormatFa
 最后编辑者: FormatFa,