首页 > Web开发 > 详细

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

时间:2018-03-05 16:45:03      阅读:172      评论:0      收藏:0      [点我收藏+]

方法有二

一: 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,能选中

 

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

原文:https://www.cnblogs.com/s-qiu/p/8509458.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!