javascript屏蔽右键功能
时间:2014-05-15 21:33:05
收藏:0
阅读:240
转自:http://www.jbxue.com/article/js/20871.html
发布时间:2014-05-15 编辑:www.jbxue.com
本文介绍了javascript屏蔽右键的二种方法,屏蔽右键在某些特殊的情况下很有用,需要的朋友参考下。
例1,javascript屏蔽右键 。
复制代码代码示例:
document.oncontextmenu=function(e){
return false;
};
return false;
};
例2,jquery禁用右键。
jquery禁用右键:
复制代码代码示例:
$(function(){
$(document).bind("contextmenu",function(e){
return false;
});
});
//js方式
function stop(){
return false;
}
document.oncontextmenu=stop;
$(document).bind("contextmenu",function(e){
return false;
});
});
//js方式
function stop(){
return false;
}
document.oncontextmenu=stop;
评论(0)