index.js
function (oTarget, sEventType, fnHandler) {
  oTarget.listeners = oTarget.listeners || {};
  var listeners = oTarget.listeners[sEventType] = oTarget.listeners[sEventType] || [];
  listeners.push(fnHandler);
  if (!listeners["_handler"]) {
    listeners["_handler"] = function (e) {
      var e = e || window.event;
      for (var i = 0, fn; fn = listeners[i++];) {
        fn.call(oTarget, e)
      }
    }
    oTarget.addEventListener ? oTarget.addEventListener(sEventType, listeners["_handler"], false) : oTarget.attachEvent('on' + sEventType, listeners["_handler"]);
  }
}
function (oTarget, sEventType, fnHandler) {
  oTarget.listeners = oTarget.listeners || {};
  var listeners = oTarget.listeners[sEventType] = oTarget.listeners[sEventType] || [];
  listeners.push(fnHandler);
  if (!listeners["_handler"]) {
    listeners["_handler"] = function (e) {
      var e = e || window.event;
      for (var i = 0, fn; fn = listeners[i++];) {
        fn.call(oTarget, e)
      }
    }
    oTarget.addEventListener ? oTarget.addEventListener(sEventType, listeners["_handler"], false) : oTarget.attachEvent('on' + sEventType, listeners["_handler"]);
  }
}
/*添加事件
@param {Object} oTarget 对象
@param {String} sEventType 事件类型
@param {Function} fnHandler 事件方法