禁用浏览器鼠标右击事件、全选事件

1、鼠标右键触发事件

  function click() 
  {  
   if(event.button==2) 
     { 
        alert('hello。。。。。。')  
     }  
  }  
  document.onmousedown=click  

2、让鼠标右键失效

<body oncontextmenu=self.event.returnValue=false> 

3、是页面文字内容无法选择或全选

<body ondragstart="window.event.returnValue=false" oncontextmenu="window.event.returnValue=false" onselectstart="event.returnValue=false"> 

猜你喜欢

转载自www.cnblogs.com/friday69/p/9178889.html