获取 鼠标左键选中的文本

if (window.getSelection) {//一般浏览器 
	userSelection = window.getSelection();} 
	else if (document.selection) {//IE浏览器、Opera 
	userSelection = document.selection.createRange();
}
userSelection=userSelection.toString();//选中的文本值

选中方法:select();

猜你喜欢

转载自blog.csdn.net/stone10086/article/details/82852877