Javascript "взимане" на селектиран от потребителя текст
0
- 31.01.2012 (Вторник)
function getSelectedText() {
var txt = '';
if (window.getSelection) {
txt = window.getSelection();
} else if (document.getSelection) {
txt = document.getSelection();
} else if (document.selection) {
txt = document.selection.createRange().text;
} else
return;
return txt.toString();
}
Тествано на: IE9,Firefox,Chrome
