1,添加css:
body{
-webkit-user-select:none;
-moz-user-select:none;
-ms-user-select:none;
user-select:none;
}
2,或添加js:
document.onselectstart=new Function("return false");
body{
-webkit-user-select:none;
-moz-user-select:none;
-ms-user-select:none;
user-select:none;
}
2,或添加js:
document.onselectstart=new Function("return false");

本文介绍了两种方式来实现网页中禁用选中文本的功能,一种是通过添加 CSS 样式,另一种是使用 JavaScript 实现。
594

被折叠的 条评论
为什么被折叠?



