Posted in Javascript onOctober 29, 2009
<script language="javascript"> function disableRightClick(e) { var message = "右键禁用..."; 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>
使用方法,直接复制代码放到<head></head>中即可。
网页禁用右键实现代码(JavaScript代码)
声明:登载此文出于传递更多信息之目的,并不意味着赞同其观点或证实其描述。
Reply on: @reply_date@
@reply_contents@