title: Call a class Method of an object on onmouseover event HTML Javascript
body: <p>I am simply trying to create a class that moves a specified DIV when the mouse is on the DIV. My problem seems to be because I am specifying a method of my custom class as the event handler. My question is can I specify the method of an object as an event Handler? Or is there any other way to do this?</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  &lt;!--
  
      function MovingDIV()
      {
          this.DIV;
          this.posX;
          this.intervalID;
          this.StartDIV = StartDIV;
          this.MoveDIV = MoveDIV;
          this.StopDIV = StopDIV;
      }
  
      function MovingDIV(DIVname)
      {
          this.DIV = document.getElementById(DIVname);            
      }
  
      function StartDIV()
      {
              this.intervalID = setInterval(this.MoveDIV, 100);
      }
      function MoveDIV()
      {
  
          this.posX = parseInt(this.DIV.style.left);
  
          this.posX += offset;
          this.DIV.style.left = this.posX;
          if(this.posX &gt; 500)
          {
              offset = -50;
          }
          else if(this.posX &lt; 50)
          {
              offset = 50;
          }
  
      }
      function StopDIV()
      {
          clearInterval(this.intervalID);
      }
  
      var MyMovingDIV = new MovingDIV("moving_div");
      var test = 123;
  
  //--&gt;
  &lt;/script&gt;
  
  &lt;div id="moving_div" style="border: 5px outset blue;  width: 160px; background-color: yellow; color: red; position: absolute; left: 400;" onmouseover = "MyMovingDIV.StartDIV()" onmouseout = "MyMovingDIV.StopDIV()"&gt;
  THE MOVING DIV CLASS
  &lt;/div&gt;     
  </code></pre>