function TForm1.GetSendText(RichEdit: TExRichEdit): string;var MsgListInfo: TStrings; i, m, n: integer; x, y: LongInt; WideStr: WideString;begin Result := ''; MsgListInfo := RichEdit.Lines; Y := SendMessage(RichEdit.Handle, EM_LINEFROMCHAR,
//脚本获取网页中选中文字 var word = document.selection.createRange().text; //获取选中文字所在的句子 var range = document.selection.createRange(); range.expand("sentence"); var sentence = range.text; alert(word);//弹出选中的文字 alert(sentence ); 例如页面上有一个文本输入框: <
选中文字,文字背景是蓝色 当前点击的元素: var e = e || event; var tag = e.target || e.srcElement; 选中文字:window.getSelection().selectAllChildren(tag); 取消选中的效果:window.getSelection().removeAllRanges();