//js 方法一
<script>
window.onload=function(){
if(document.all){
document.onselectstart= function(){return false;}; //for ie
}
else{
document.onmousedown= function(){return false;};
document.onmouseup= function(){return true;};
}
oDiv.onselectstart = new Function('event.returnValue=false;');
}
</script>
方法二:css
-moz-user-select:none;-ms-user-select:none;-webkit-user-select:none;user-select:none;
结合的写法
<div id="test" style="-moz-user-select: none; " onselectstart = "return false;" >这里的文字不能选中了</div>
------------------------
if(document.all)
{
obj.onselectstart = function(){return false;}; //for ie
}
else
{
obj.onmousedown = function(){return false;};
obj.onmouseup = function(){return true;};
}