//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  >这里的文字不能选中了</div>

------------------------

if(document.all)
{
   obj.onselectstart = function(){return false;}; //for ie
}
else
{
   obj.onmousedown = function(){return false;};

   obj.onmouseup = function(){return true;};
}

 

相关文章:

  • 2022-12-23
  • 2021-10-30
  • 2021-08-20
  • 2022-12-23
  • 2022-01-24
  • 2022-12-23
猜你喜欢
  • 2021-10-05
  • 2022-12-23
  • 2022-01-18
  • 2021-12-08
  • 2021-11-12
  • 2022-12-23
相关资源
相似解决方案