主要目的の 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 != 未定義 && e.selectionEnd != 未定義)
return e.value.substring(e.selectionStart,e.selectionEnd);
else return "";
}