title: JavaScript multiple instances
body: <p>I'm trying to create multiple instances of a JavaScript "class" or object but it seems to be acting as a singleton... Could someone assist me with the following code?</p>
  
  <pre><code>        (function() {
              /*
               * Canvas object
               */
              var Canvas = function( el ) {
                  _self = this;
                  _self.el = el;
              }
              Canvas.prototype.init = function() {
                  _self.el.style.backgroundColor = "#000";
                  _self.el.addEventListener( "mousedown", _self.onMouseDown );
              }
              Canvas.prototype.onMouseDown = function() {
                  console.log( 'onMouseDown: ', _self.el );
              }
  
              var cOne = new Canvas( document.getElementById('one') );
              var cTwo = new Canvas( document.getElementById('two') );
              cOne.init();
              cTwo.init();
          })();
  </code></pre>