主要用到的js代码
function getSelectedText(){
var selectedText;
var textField=document.getElementById('inputTextarea');
if(window.getSelection) selectedText=getTextFieldSelection(textField);//getTextFieldSelection(document.getElementById("inputTextArea"));
else selectedText=document.selection.createRange().text;
alert(selectedText);
}
function getTextFieldSelection(e){
//var oEvent=arguments.callee.caller.arguments[0];
if(e.selectionStart != undefined && e.selectionEnd != undefined)
return e.value.substring(e.selectionStart,e.selectionEnd);
else return "";
}