questo articolo è vecchio, ma credo funzioni ancora:
http://www.webreference.com/js/column12/index.html
oppure questo (che ho provato su IE8):
Codice PHP:
<script language=javascript>
function getSelText()
{
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;
}
</script>