假设用户选择(用他/她的鼠标)段落的第一行。稍后,他/她选择页面下方的另一行。有没有办法突出显示先前选择的文本(除了新选择的文本)?我怎样才能实现这一目标?
提前谢谢了。
假设用户选择(用他/她的鼠标)段落的第一行。稍后,他/她选择页面下方的另一行。有没有办法突出显示先前选择的文本(除了新选择的文本)?我怎样才能实现这一目标?
提前谢谢了。
是的,您可以结合检查 mouseDown/mouseUp 事件和 document.selection/getSelection 来执行此操作。
一般的逻辑是这样的:
你应该使用一些东西来处理跨浏览器的实现。看看这个人的片段
I do not believe so. The highlighting is not server-side/localhost controlled; It's a function usually built into the operating system that allows highlighting of text, or sometimes it's a function in the web browser.
Sorry I couldn't be more helpful or give you a solution that allows you to do this. Only other way I know is to use IFrames, because they act as oppositions from the primary page's highlighted elements/text.