屏蔽鼠标和就键盘

屏蔽鼠标:

通过修改网页属性的屏蔽鼠标右键的方法:<body oncontextmenu=self.event.returnValue=false>

通过修改网页属性的屏蔽鼠标左键的方法:<body onselectstart="return false">

通过修改网页属性的屏蔽鼠标左右键的方法:<body oncontextmenu=self.event.returnValue=false onselectstart="return false">

屏蔽键盘:(查看键盘keycode

 <body onkeydown="enter()">

<SCRIPT LANGUAGE="JavaScript">
function enter()
{
if(window.event.keyCode==123){window.event.returnValue= false;} //屏蔽 F12

if(window.event.ctrlKey && window.event.keyCode==78){window.event.returnValue= false;}  //屏蔽 Ctrl+n 

if(window.event.shiftKey  && window.event.keyCode==78){window.event.returnValue= false;}  //屏蔽 shift+n 

if(window.event.altKey && window.event.keyCode==78){window.event.returnValue= false;}  //屏蔽 alt+n 

if(window.event.srcElement.tagName == "A" && window.event.keyCode==78){window.event.returnValue= false;}  //屏蔽 鼠标左键 +n 
}
</SCRIPT>

猜你喜欢

转载自www.cnblogs.com/python-only/p/9655814.html