做一个透明div放在文字所在div上面

解决方案 »

  1.   

    <div onselectstart="return false" onselect="document.selection.empty()">text</div>
      

  2.   

    onselect="document.selection.empty()"怎么在JS文件中写呢?var selectDiv = document.createElement("div");
    document.body.appendChild(selectDiv);我要把document.selection.empty()放到这里。
      

  3.   

    var selectDiv = document.createElement("div");   selectDiv.onselectstart=function(){return false;};
       selectDiv.onselect=function(){document.selection.empty()};document.body.appendChild(selectDiv);