废话不多说了直接给大家贴代码了。
代码如下:
<script language="JavaScript"><!--//js禁用某些键的代码//www.VeVB.COmfunction key(){ if(event.shiftKey){window.close();}//禁止Shiftif(event.altKey){window.close();}//禁止Altif(event.ctrlKey){window.close();}//禁止Ctrlreturn false;}document.onkeydown=key;if (window.Event)document.captureEvents(Event.MOUSEUP);function nocontextmenu(){event.cancelBubble = trueevent.returnValue = false;return false;}function norightclick(e){if (window.Event){if (e.which == 2 || e.which == 3)return false;}elseif (event.button == 2 || event.button == 3){event.cancelBubble = trueevent.returnValue = false;return false;}}//禁右键document.oncontextmenu = nocontextmenu; // for IE5+document.onmou<a href="//www.VeVB.COm/article/1141.html" target="_blank" class="infotextkey">sed</a>own = norightclick; // for all others//--></script>
<body onselectstart="return false"; onpaste="return false";>
1. oncontextmenu="window.event.returnValue=false" 将彻底屏蔽鼠标右键特效
<table border oncontextmenu=return(false)><td>no</table> 可用于Table
2. <body onselectstart="return false"> 取消选取、防止复制
3. onpaste="return false" 不准粘贴
4. oncopy="return false;" oncut="return false;" 防止复制
PS:JS防止后退,刷新,关闭的解决办法
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><html><head><title> New Document </title></head><script language="javascript">function RunOnBeforeUnload() {window.onbeforeunload = function(){ return '将丢失未保存的数据!'; } }</script><body onload="RunOnBeforeUnload()">刷新,关闭,后退,F5 测试</body></html>
虽然onbeforeunload这个事件已经Web标准被淘汰,但目前能实现这个效果的也就只有这个事件.还好浏览器都能很好的支持.
测试结果:
IE6.0,FireFox,Chrome通过
新闻热点
疑难解答