位置:海鸟网 > IT > JavaScript >

JavaScript 屏蔽鼠标右键

<script language="JavaScript">
 //锁鼠标右键和键盘CONTEXTMENU键
 function click(e) {
  if (document.all) {
   if (event.button==2||event.button==3) {
    oncontextmenu='return false';
   }
  }
 }

 document.onmousedown=click;
 document.oncontextmenu = new Function("return false;")
</script>