用一个单词展开所选文本 [英] Expand selected text by one word
本文介绍了用一个单词展开所选文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
IE的TextRange对象具有扩展功能,通过该功能可以扩展文本选择以完成单词或句子。它只适用于IE。更多: http://www.webreference.com/js/column12/trmethods.html
The TextRange object of IE has expand function through which you can expand the text selection to complete the word or sentence. It only works for IE. More: http://www.webreference.com/js/column12/trmethods.html
如果有人可以帮助我并使其跨浏览器工作,那将会很棒。
It would be great if someone can help me and make it work cross-browser.
推荐答案
WebKit和Firefox 4有一个 modify() Selection
对象的方法,它与TextRanges的 expand()
方法执行类似的工作。
WebKit and Firefox 4 have a modify() method of the Selection
object that does a similar job to the expand()
method of TextRanges.
这篇关于用一个单词展开所选文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文