Home >Web Front-end >HTML Tutorial >The mouse does not allow you to select text in a certain area of ​​the webpage_html/css_WEB-ITnose

The mouse does not allow you to select text in a certain area of ​​the webpage_html/css_WEB-ITnose

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-24 11:39:331300browse

1. Add styles to elements -webkit-user-select:none; -moz-user-select:none; -ms-user-select:none; user-select:none;

2. ie6-ie9 needs to add the following js

a. //The text cannot be selected
var oDrag = document.getElementsByClassName("ard-adv");
for(var i =0; i
i ) >b. //The entire webpage

 document.body.onselectstart = document.body.ondrag = function(){

  return false;

 }

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn