您的位置:首页 > 其它

屏蔽鼠标右键的方法

2014-07-20 23:00 204 查看
使用标准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])}); //屏蔽复制按键
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: