屏蔽鼠标右键的方法

使用标准dom的方法:

document.oncontextmenu=function(oEvent){

     if(window.event){ //IE

         oEvent=window.event;

         oEvent.returnValue=false;

  }else{//FireFox

         oEvent.preventDefault();

     }

}

使用jquery的方法:

1. $(document).bind("contextmenu",function(){return false;});  //屏蔽右键

2. $(document).bind("selectstart",function(){return false;}); //屏蔽文本选择

3.$(document).keydown(function(){return key(arguments[0])}); //屏蔽复制按键 

posted @ 2014-07-20 23:00  nicholaswei  阅读(225)  评论(0)    收藏  举报