复制代码代码如下:
function getSelectedText() { //код этой функции заимствован из: http://www.codetoad.com/javascript_get_selected_text.asp
вар txt = "";
если (window.getSelection) {
txt = window.getSelection();
} еще если (window.document.getSelection) {
txt = window.document.getSelection();
} еще если (window.document.selection) {
txt = window.document.selection.createRange().text;
}
вернуть текст;
}