Home  >  Article  >  Web Front-end  >  网页某块区域鼠标不让选中文字_html/css_WEB-ITnose

网页某块区域鼠标不让选中文字_html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-24 11:39:331234browse

1、给元素加样式   -webkit-user-select:none; -moz-user-select:none; -ms-user-select:none; user-select:none;

2、ie6-ie9 需要加以下js

a.  //不可选中文字
        var oDrag = document.getElementsByClassName("ard-adv");   
        for(var i=0; i        {
            oDrag[i].onselectstart = oDrag[i].ondrag = function(){return false;};
        }

b.   //整个网页

   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