<textarea id="runcode19982"><script language= "JavaScript" > var agt=navigator.useragent.tolowercase (); var ie = ((Agt.indexof ("MSIE")!=-1) && (Agt.indexof ("opera") = = 1) && (Agt.indexof ("omniweb") = = 1)); function A () {var myarea = document.getElementById ("s"); var selection; if (!ie) {if (myarea.selectionstart!= undefined) {selection = MyArea.value.substr (Myarea.selectionstart, Myarea.selec Tionend-myarea.selectionstart); }}else{if (window.getselection) {selection = Window.getselection (); }else if (document.getselection) {selection = Document.getselection (); }else if (document.selection) {selection = Document.selection.createRange (). text; } alert (Selection)} </script> <input type= "text" value= "Testtest" id= "S" name= "s" onmouseup= "javascript : A () "/></textarea>
[Ctrl + A All SELECT Note: If the need to introduce external JS need to refresh to perform]