Okay, you asked for it!
This will work in IE - it won't work in Chrome - haven't tested elsewhere:
function getalert()
{
var selTxtRng = document.selection.createRange();
var selTxt = selTxtRng.text;
alert(selTxt);
}
If you need a cross-browser implementation, look for the function "ToggleTagWrap" in the source code for any Code-Project page that includes a post editor. ('editor' used for Quick Answers comment wont work)