js屏蔽功能键F1~12以及鼠标右键和鼠标左键
function window.onhelp(){return false} //屏蔽F1帮助
document.onkeydown = function(){
if(window.event && window.event.keyCode == 113) {
window.event.keyCode = 505;
}
if(window.event && window.event.keyCode == 114) {
window.event.keyCode = 505;
}
if(window.event && window.event.keyCode == 115) {
window.event.keyCode = 505;
}
if(window.event && window.event.keyCode == 116) {
window.event.keyCode = 505;
}
if(window.event && window.event.keyCode == 117) {
window.event.keyCode = 505;
}
if(window.event && window.event.keyCode == 118) {
window.event.keyCode = 505;
}
if(window.event && window.event.keyCode == 119) {
window.event.keyCode = 505;
}
if(window.event && window.event.keyCode == 120) {
window.event.keyCode = 505;
}
if(window.event && window.event.keyCode == 121) {
window.event.keyCode = 505;
}
if(window.event && window.event.keyCode == 122) {
window.event.keyCode = 505;
}
if(window.event && window.event.keyCode == 123) {
alert("F12被禁用");
event.keyCode=0;
event.returnValue=false;
}
if(window.event && window.event.keyCode == 13) {
window.event.keyCode = 505;
}
if(window.event && window.event.keyCode == 8) {
alert(str+"\n请使用Del键进行字符的删除操作!");
window.event.returnValue=false;
}
if(window.event && window.event.keyCode == 505){
alert(str)
window.event.returnValue=false;
}
}
document.onmousedown=function(oEvent){
if(window.event)
oEvent=window.event;
if(oEvent.button==2)
alert("鼠标右键不可用");
if(oEvent.button==1)
alert("鼠标左键不可用");
}
鼠标右键禁用还有种方式
<script type="text/javascript">document.oncontextmenu = function (e) { return false; }</script>
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。