控制HTML页面内容不能选中的方法


方法有二

一: css 方法

user-seletct: none;
-webkit-user-seletct: none;
-moz-user-seletct: none;
-ms-user-seletct: none;

none: 不能选中内容

text: 能选中内容

二:js 方法

document.body.onselectstart = function(){
  return false;
}

返回 false,不能选中

返回 true,能选中

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。