code: function(element, type, handler) {
      if(element.addEventListener) {
        addEvent = function(element, type, handler) {
          element.addEventListener(type, handler, false);
        };
      } else if(element.attachEvent) {
        addEvent = function(element, type, handler) {
          element.attachEvent('on' + type, handler);
        };
      } else {
        addEvent = function(element, type, handler) {
          element['on' + type] = handler;
        };
      }
      addEvent(element, type, handler);
    }
docs: Cross-browser compatible event handler.