Select some text and press the button.
The script I made, thanks to Peter-Paul Koch for his demo-page. Copy and modify it :).
window.onload=function() { document.getElementById('getselection').onclick=function() { seltext=''; if (window.getSelection()) { seltext = window.getSelection(); } else if (document.getSelection()) { seltext = document.getSelection(); } else if (document.selection) { seltext = document.selection.createRange().text; } window.alert(seltext); } }