比如双击选定和拖动鼠标选定
用document.onmouseup来抓获事件,document.getSelection来获取选定内容
document.onmouseup
document.getSelection
document.onmouseup = function() { var sel = document.getSelection(); if (sel.length > 0) { alert(sel); } }
这里有个demo
标签
查看
634 次