<script>
function click(e) {
if (document.all) {
if (event.button == 2 || event.button == 3) {
oncontextmenu = 'return false';
};
};
if (document.layers) {
if (e.which == 3) {
oncontextmenu = 'return false';
};
};
};
if (document.layers) {
document.captureEvents(Event.MOUSEDOWN);
};
document.onmousedown = click;
document.oncontextmenu = new Function("return false;")
document.onkeydown = document.onkeyup = document.onkeypress = function () {
if (window.event.keyCode == 123) {
window.event.returnValue = false;
return (false);
};
};
</script>
参考
网页如何禁止鼠标右键和F12,键盘另存为、粘贴、复制事件
HTML屏蔽F12、右键、开发者工具、审查元素