首页 > 技术文章 > 防止双击文字选中

holy-amy 2018-12-30 20:20 原文

if(document.all){
        document.onselectstart= function(){return false;}; //for ie
      }else{
        document.onmousedown= function(){return false;};
        document.onmouseup= function(){return true;};
      }
      document.onselectstart = new Function('event.returnValue=false;');

  

推荐阅读