首页 > Web开发 > 详细

[JS] 屏蔽右键

时间:2017-07-06 19:59:40      阅读:307      评论:0      收藏:0      [点我收藏+]
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;  // for IE5+
document.onmousedown = norightclick;  //for all others  

 

[JS] 屏蔽右键

原文:http://www.cnblogs.com/frost-yen/p/7127937.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!