鼠标经过选中元素内容
2016-12-01 11:05
183 查看
function copyTo(text) {
if (document.body.createTextRange) {
var range = document.body.createTextRange();
range.moveToElementText(text);
range.select();
} else if (window.getSelection) {
var selection = window.getSelection();
var range = document.createRange();
range.selectNodeContents(text);
selection.removeAllRanges();
selection.addRange(range);
}
}
//
onmouseover="copyTo(this);"
if (document.body.createTextRange) {
var range = document.body.createTextRange();
range.moveToElementText(text);
range.select();
} else if (window.getSelection) {
var selection = window.getSelection();
var range = document.createRange();
range.selectNodeContents(text);
selection.removeAllRanges();
selection.addRange(range);
}
}
//
onmouseover="copyTo(this);"
相关文章推荐
- 同级元素,鼠标经过高亮,鼠标离开还原(除选中已高亮元素时),点击确定高亮
- js获取网页鼠标选中部分的内容
- selenium--unittest定位元素内容为空时模拟鼠标点击的方法
- 鼠标经过图像,内容变换
- 鼠标经过文本内特定类型元素显示提示信息
- 伪元素::selection -- CSS ::selection 伪元素,定义用户鼠标已选择内容的样式
- PowerDesigner 12.5 导致 Word 2003文档内容无法选中以及点击鼠标没反应的问题
- 鼠标经过超链接上,元素(li)背景变色的代码
- PowerDesigner 125 导致 Word 2007文档内容无法选中以及点击鼠标没用
- js获取鼠标选中的元素的xpath
- 鼠标经过超链接上,元素(li)背景变色的代码
- PowerDesigner 12.5 导致 Word文档内容无法选中以及点击鼠标无反应的问题
- 扩展:datagrid鼠标经过提示单元格内容
- 当鼠标滑过文本框自动选中输入框内容的JS代码分享
- chrome下float元素下input选中内容bug
- selenium用java选中ul的最后一个li元素里内容
- 扩展:datagrid鼠标经过提示单元格内容
- 解决鼠标经过内部元素触发onmouseout事件的问题
- 鼠标经过标题上显示不同DIV的内容
- jQuery获取选中内容及设置元素属性的方法