IE与NN两者的对象模型不一样,要分别对待
例如:
<html>
<head>
<META http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body>
<SCRIPT language=JavaScript1.2>
if (window.Event)
  document.captureEvents(Event.MOUSEUP);
function norightclick(e)
{
if (window.Event)
{
if (e.which == 2 || e.which == 3)
{
alert("您按了右键!!")
return false;
}
else
alert("您按了左键!!")
}
else
{
if (event.button == 2 || event.button == 3)
alert("您按了右键!!")
else
alert("您按了左键!!")
}
}
document.onmousedown = norightclick;
</SCRIPT>
右键的完整代码!支持IE NN!!!
</body>
</html>

解决方案 »

  1.   

    <body ondblclick=showtest(event)>
    </body>
    <script language="javascript">
    function showtest(e){
      e = (e)? e: (window.event)? window.event: "";
      alert(e.layerX);
      //document.getElementById("divTest");
      //每个元素用getElementById方法吧,参数为元素的ID
    }
      

  2.   

    我一般用这样的写法:<BODY ondblclick="dblClkOnBody(event)">
    <textarea style="background-color:gray;width:300;height:300;overflow-y:hidden" name="emu"></textarea>
    <script language="javascript">
    function dblClkOnBody(event)
    {
      var e = (document.all)?event.srcElement:event.target
      alert(e.name);
      if (e.type != null)
        alert(e.type);
      else
    alert(e.tagName); 
    }
    </script>
    </BODY>欢迎到 http://expert.csdn.net/Expert/TopicView1.asp?id=1238516 上讨论。