码迷,mamicode.com
首页 > 其他好文 > 详细

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

时间:2018-06-13 18:08:07      阅读:161      评论:0      收藏:0      [点我收藏+]

标签:文字   ons   body   tar   IV   star   hello   val   false   

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"> 

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

标签:文字   ons   body   tar   IV   star   hello   val   false   

原文地址:https://www.cnblogs.com/friday69/p/9178889.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!