html 禁用鼠标
2024-07-04 09:37:31
body样式禁用
body{
-moz-user-select: -moz-none;
-moz-user-select: none;
-o-user-select:none;
-khtml-user-select:none;
-webkit-user-select:none;
-ms-user-select:none;
user-select:none;
}
js
function disableSelection(event) {
if (typeof event.preventDefault !== "undefined") {
event.preventDefault();
} else {
event.returnValue = false;
}
}
// // 在加载页面时绑定事件
document.addEventListener("mousedown", disableSelection);
document.addEventListener("contextmenu", disableSelection);
上一篇:js自动计算
随机文章
- 回归正常的生产生活,我们还需多久?国家卫健委回应2022-10-13
- 陆基中段反导拦截试验画面首次披露2022-10-08
- 中国如何应对中度、重度老龄化?2022-10-06
- 10月6日7时至22时 海口实行临时性全域静态管理2022-10-06
- 江苏南京新增5例核酸检测结果异常人员 活动轨迹公布2022-10-16
- pdf.js 跨域请求2019-09-04
- 当了近8年县委书记的他,被查2022-10-09
- 10年间报考人数翻66倍,“教资热”的背后是什么?2022-10-18
- 31省区市新增本土“427+1662”2022-10-11
- 圆明园罹难162周年纪念日,众多游客前往参观2022-10-18
相关推荐
- 台媒:小S确诊新冠紧急停工,节目暂停录制2022-10-04
- “刷脸”时代:如何护脸又护财?2022-10-05
- 每年超2000万人退休,“新老人”如何养老?2022-10-07
- 基辅、利沃夫……乌克兰多地关键基础设施遭导弹袭击2022-10-10
- 北京首批毕业生公寓试点项目全面入住2022-10-10
- 曾被称作“世界第八奇迹”,富士康美国工厂为何黄了2022-10-14
- 鄱阳湖水位持续上涨 重回8米线以上2022-10-15
