网页禁止右键代码:(代码需加在head区)
推荐:
<!--禁止鼠标右键代码-->
<noscript><iframe src=*.html></iframe></noscript>
<script language=javascript>
<!--
if (window.Event)
document.captureEvents(Event.MOUSEUP);
function nocontextmenu(){
event.cancelBubble = true
event.returnValue = false;
return false;
}
function norightclick(e){
if (window.Event){
if (e.which == 2 || e.which == 3)
return false;
}
else
if (event.button == 2 || event.button == 3){
event.cancelBubble = true
event.returnValue = false;
return false;
}
}
document.oncontextmenu = nocontextmenu; // for IE5+
document.onmousedown = norightclick; // for all others
//-->
</script>
1.将彻底屏蔽鼠标右键,无右键菜单
<body oncontextmenu="window.event.returnvalue=false">
也可以用于网页中Table框架中
<table border oncontextmenu=return(false)><td>no</table>
2.取消选取、防止复制
<body onselectstart="return false">
3.不准粘贴
<body onpaste="return false">
4.防止复制
<body oncopy="return false;" oncut="return false;">