1、获取选中的文字: 2、取消处于选中状态的文字: ...
获取选中的文字: document.selection.createRange .text IE 以下使用 window.getSelection .toString 其他浏览器使用 取消处于选中状态的文字: document.selection.empty IE 以下使用 window.getSelection .removeAllRanges 其他浏览器使用 上述方法不仅对div或p标签中的 ...
2014-09-23 17:08 0 16346 推荐指数:
1、获取选中的文字: 2、取消处于选中状态的文字: ...
/*获取选中的文字*/var _getSelectedText = function() { if (window.getSelection) { return window.getSelection().toString(); } else if (document.getSelection ...
原文地址:http://www.zhangxinxu.com/wordpress/?p=755 ...
onselectstart属性 ...
::selection {background:#FF9; color:#F00;}::-moz-selection {background:#FF9; color:#F00;}::-webkit-s ...
替换html中选中的文字 function replaceSelection() { if (window.getSelection) { var selecter = window.getSelection ...
...