js gets the text code selected by the mouse as follows:
<html><head><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312" /><title>js Get the text selected by the mouse</title> <SCRIPT LANGUAGE="JavaScript"><!--function SelectText(){try{var selecter=window.getSelection();if(selecter!=null&&selecter.trim()!=""){alert(selecter);}}catch(err){var selecter=document.selection.createRange();var s=selecter.text;if(s!=null&&s.trim()!=""){alert(s)}}}String.prototype.trim=function(){return this.replace(/(^/s*)|(/s*$)/g,"");}//--></SCRIPT> </head><body><span onClick="SelectText()">Fishes in the river die strangely, residents downstream suffer from strange diseases frequently, and plants along the coast constantly mutate. Are they residual pesticides? Or a biochemical attack? Please pay attention to CCTV-10 "Scientific Exploration" tonight, the upcoming special program: "The Mysterious Foot Washing Man by the River--Chinese Men's Football Team"</span></body></html>JS gets the selected value of the mouse
if (window.getSelection) {//General browser userSelection = window.getSelection();} else if (document.selection) {//IE browser, Opera userSelection = document.selection.createRange();}userSelection.toString();The above is the text selected by the JS mouse introduced by the editor. I hope it will be helpful to everyone. If you have any questions, please leave me a message and the editor will reply to everyone in time. Thank you very much for your support to Wulin.com website!