<script language="javascript"> function disableRightClick(e) { var message = "孩子想干嘛馁!如果要收藏本站请按CTRL+D哦!如果你是在试图偷取本站代码、那么别费劲了,你右键怎么按都是这个窗口!" if(!document.rightClickDisabled) // initialize { if(document.layers) { document.captureEvents(Event.MOUSEDOWN); document.onmousedown = disableRightClick; } else document.oncontextmenu = disableRightClick; return document.rightClickDisabled = true; } if(document.layers || (document.getElementById && !document.all)) { if (e.which==2||e.which==3) { alert(message); return false; } } else { alert(message); return false; } } disableRightClick(); </script>
完整实例:http://github.crmeb.net/u/defu