控制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

相關文章
相關標籤/搜索