用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