try something like (did not test,  so it might not work):
var ie5 = (document.all && document.getElementById) ? true : false;
var ie4 = (document.all && !document.getElementById) ? true : false;
var n6 = (document.getElementById && !document.all) ? true : false;
var n4 = (document.layers) ? true : false;if (ie5) {document.oncontextmenu = function(){return false}}
if (n6) {document.onmouseup = function(e) {if (e.button == 3) return false}}
if(n4) {window.captureEvents(Event.MOUSEDOWN);window.onmousedown =
function(e){if(e.target==document)return false;}}
if (ie4) { document.onmousedown = function(){return false}}

解决方案 »

  1.   

    试过了,应该是这样:
    document.onclick = function (e) { if (e.which == 3) return false };
    我也不知道是什么原因这样才行,我看到一些书上写的都是说NS6+是用button,NS4才用which的,我在NS6和NS7上都试过了只能写成这样!还有一点就是,我用document.ondblclick = function () { alert("双击鼠标") }这个事件为什么捕捉不到鼠标双击的呢?在NS6和NS7都是不能,在IE就可以了!
      

  2.   

    首先,在ns里面的ondblclick是window对象的事件。
    第二,在ns里面ondblclick必须先在body定义过才可以重新赋值。以下在ns6.2,ie5通过:<HTML>
    <HEAD>
    <SCRIPT LANGUAGE="JavaScript">
    <!--
    function init(){
    if (document.all)
    document.ondblclick = function () { alert("doubleclick") }
    else
    window.ondblclick = function () { alert("doubleclick") }
    }
    //-->
    </SCRIPT>
    </HEAD>
    <BODY onload="init()" ondblclick="">
    </BODY>
    </HTML>
      

  3.   

    http://www.tisin.com/school/homepage/jscript/lesson/learn3/tech/js/evnt6.htm#1093910这个文档把我骗了,ns的document根本不认识ondblclick和onclick。
      

  4.   

    var message="";
    document.oncontextmenu=new Function("return false")
    ///////////////////////////////////
    function clickIE() {
          if (document.all) {
        (message);return false;
          }
    }function clickNS(e) {
          if(document.layers||(document.getElementById&&!document.all)) {
        if (e.which==2||e.which==3)
        {
      (message);return false;
        }
          }
    }
    if (document.layers)
    {
          document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;
    }
    else{
          document.onmouseup=clickNS;document.oncontextmenu=clickIE;
    }
      

  5.   

    上面的在ns6.2下面不行,if (document.layers) 改为 if (!document.all) 后通过。<BODY>
    <SCRIPT LANGUAGE="JavaScript">
    <!--
    document.oncontextmenu=new Function("return false")
    //-->
    </SCRIPT>
    </BODY>在IE5和ns6.2下面竟然都通过了,天啊
      

  6.   

    但我真的看不明白sunmingdong() 那两个函数里的(message)这个语句是什么意思呢?