The JS implementation returns the selected text based on the current text selection

  • 2020-03-30 03:00:56
  • OfStack

 
<script> 
function doit(){ 
newT=document.selection.createRange() 
clipboardData.setData("Text",newT.text) 
if(clipboardData.getData("Text")!=null){ 
document.all.pp.value=clipboardData.getData("Text") 
} 
} 
</script> 
<span id=ww onmouseup=doit()> 
 May occur   I need to change to add  
 Experts recommend   Add sorting  
<table> 
<tr> 
<td>test</td> 
<td>what</td> 
</tr> 
</table> 
</span> 
<textarea name=pp></textarea> 

Related articles: