JS实现屏蔽鼠标右键

时间:2010-04-14 12:15:21  来源:第二电脑网  作者:第二电脑网

  第二电脑网导读: = trueevent.returnValue = false;return false;}function norightclick(e) {if (window.Event) {if (e.which == 2 || e.which == 3)return false;}elseif (event.button == 2 || event.button == 3){event.cancelBubble = trueevent.returnValue = false;return false;
  正文:加入如下代码到head区域中:

<script language="JavaScript">
<!--

if (window.Event)
document.captureEvents(Event.MOUSEUP);

function nocontextmenu()
{
event.cancelBubble = true
event.returnValue = false;

return false;
}

function norightclick(e)
{
if (window.Event)
{
if (e.which == 2 || e.which == 3)
return false;
}
else
if (event.button == 2 || event.button == 3)
{
event.cancelBubble = true
event.returnValue = false;
return false;
}

}

document.oncontextmenu = nocontextmenu; //对ie5.0以上
document.onmousedown = norightclick; //对其它浏览器
//-->
</script>
"JS实现屏蔽鼠标右键"由第二电脑网原创提供,转载请注明:http://www.002pc.com/master/College/Programming/JavaScript/13626.html


关键字:

关于《JS实现屏蔽鼠标右键》文章的评论

站内搜索: 高级搜索

热门搜索: Windows style 系统 tr IP QQ CPU 安装 function 注册 if td