DivDialog = Class.create();DivDialog.construct = function($self,$class){
    this.initialize = function() 
{
              _div = document.createElement("div");
              var that = this;
              _div.onMouseDown = that.getDown;
        }

this.getDown = function(event)
{
if(window.event.button==2)
                {
                       alert("右键点击");
                 }
}
}我给 _div 注册了鼠标事件,但是为什么没有效果,是我写错了吗

解决方案 »

  1.   

    重新贴一遍,有点错误
    DivDialog = Class.create();DivDialog.construct = function($self,$class){
        var _div = null; 
       
        this.initialize = function() 
    {
                  _div = document.createElement("div");
                  var that = this;
                  _div.onMouseDown = that.getDown
            }

    this.getDown = function(event)
    {
    if(window.event.button==2)
                    {
                           alert("右键点击");
                     }
    }
    }
      

  2.   

    Click the link to solve your problem.Good luck!