一:直接在body添加属性
- <body oncontextmenu="return false" onselectstart="return false" oncopy="return false">
oncontextmenu:这个是点击鼠标右键是否显示面板
onselectstart:鼠标能否选中文本
oncopy:用户执行copy时候操作
二:js实现
- document.oncontextmenu = function(){
- return false;
- }document.onkeydown = function(){
- if (event.ctrlKey && window.event.keyCode==67){
- return false;
- }
- }document.body.oncopy = function (){
- return false;
- }//不建议连选中文本都不行document.onselectstart = function(){
- //return false;}