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

方法有二css

一: css 方法web

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

none: 不能选中内容io

text: 能选中内容function

二:js 方法select

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

返回 false,不能选中方法

返回 true,能选中let

相关文章
相关标签/搜索