1 //禁止鼠标右键和F12 2 function click(e) { 3 if (document.all) { 4 if (event.button==2||event.button==3) { 5 alert("欢迎光临寒舍,有什么需要帮忙的话,请与管理员联系!谢谢您的合作!!"); 6 oncontextmenu='return false'; 7 } 8 } 9 if (document.layers) { 10 if (e.which == 3) { 11 oncontextmenu='return false'; 12 } 13 } 14 } 15 if (document.layers) { 16 document.captureEvents(Event.MOUSEDOWN); 17 } 18 document.onmousedown=click; 19 document.oncontextmenu = new Function("return false;") 20 document.onkeydown = document.onkeyup = document.onkeypress = function () { 21 if (window.event.keyCode == 123) { 22 window.event.returnValue = false; 23 return (false); 24 } 25 }