[JS] 屏蔽右键

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  
时间: 2024-10-21 17:59:07

[JS] 屏蔽右键的相关文章

js 屏蔽右键,加入收藏夹,设为主页

-----------------------------------------------------------------------------------------------------------------css @charset "gb2312";/* CSS Document */ body{ margin:0; margin-top:3px; padding:0; font-size:12px; line-height:20px; color:#333;}.h

JS屏蔽右键菜单,复制,粘帖xxxxx........

1 //屏蔽右键菜单 2 document.oncontextmenu = function (event) { 3 if (window.event) { 4 event = window.event; 5 } try { 6 var the = event.srcElement; 7 if (!((the.tagName == "INPUT" && the.type.toLowerCase() == "text") || the.tagName

js屏蔽右键代码

<script type="text/javascript"> document.body.oncontextmenu=document.body.ondragstart= document.body.onselectstart=document.body.onbeforecopy=function(){return false;} ; document.body.onselect=document.body.oncopy=document.body.onmouseup=f

js屏蔽浏览器右键菜单,粘贴,复制,剪切,选中(转)

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-

网页中最常用的JS代码(js禁止右键、禁止复制,设为首页,加入收藏代码)

<body oncontextmenu=”return false”></body> <!– 禁用右键: –> <script> function stop(){ return false; } document.oncontextmenu=stop; </script> <body onselectstart=”return false”> 取消选取.防止复制 oncopy=”return false;” oncut=”return

JS 禁止右键,禁止复制,禁止粘贴

原文:JS 禁止右键,禁止复制,禁止粘贴 如何用用javascript 禁止右键,禁止复制,禁止粘贴,做站时常会用到这些代码,所以收藏了一下! 1. oncontextmenu="window.event.returnValue=false" 将彻底屏蔽鼠标右键特效<table border oncontextmenu=return(false)><td>no</table> 可用于Table 2. <body onselectstart=&q

javascript屏蔽右键功能

转自:http://www.jbxue.com/article/js/20871.html 发布时间:2014-05-15   编辑:www.jbxue.com 本文介绍了javascript屏蔽右键的二种方法,屏蔽右键在某些特殊的情况下很有用,需要的朋友参考下. 例1,javascript屏蔽右键 . 复制代码代码示例: document.oncontextmenu=function(e){ return false; }; 例2,jquery禁用右键. jquery禁用右键: 复制代码代码示

网页中最常用的JS代码(js禁止右键、禁止复制)

<body oncontextmenu="return false"></body> <!– 禁用右键: –><script>function stop(){return false;}document.oncontextmenu=stop;</script> <body onselectstart="return false"> 取消选取.防止复制 oncopy="return fa

Js屏蔽键盘事件

<script>           function KeyDown(){ //屏蔽鼠标右键.Ctrl+n.shift+F10.F5刷新.退格键            //alert("ASCII代码是:"+event.keyCode);            if ( (window.event.altKey)&&            (  (window.event.keyCode==37)|| //屏蔽 Alt+ 方向键 ←