用JavaScript获取选中的文字
function getSelectText() {
return document.selection && document.selection.createRange().text | window.getSelection && window.getSelection() | document.getSelection && document.getSelection() | ’’; |
}
支持IE6、Firefox和Chrome
原文:
参考:
参考:
Use JavaScript and jQuery to Get User Selected Text, and then Do Something (Useful?) With It