zoukankan      html  css  js  c++  java
  • FineMessBox的js依赖导致错误Uncaught ReferenceError: addEvent is not defined

    /**
     * COMMON DHTML FUNCTIONS
     * These are handy functions I use all the time.
     *
     * By Seth Banks (webmaster at subimage dot com)
     * http://www.subimage.com/
     *
     * Up to date code can be found at http://www.subimage.com/dhtml/
     *
     * This code is free for you to use anywhere, just keep this comment block.
     */
    
    /**
     * X-browser event handler attachment and detachment
     * TH: Switched first true to false per http://www.onlinetools.org/articles/unobtrusivejavascript/chapter4.html
     *
     * @argument obj - the object to attach event to
     * @argument evType - name of the event - DONT ADD "on", pass only "mouseover", etc
     * @argument fn - function to call
     */
    

    插件FineMessBox下面有两个js文件

    common.js

    subModal.js

    subModal.js依赖common.js中的两个方法:addEvent,removeEvent

    所以使用subModal的时候别忘记引用js文件common.js

    function addEvent(obj, evType, fn){
     if (obj.addEventListener){
        obj.addEventListener(evType, fn, false);
        return true;
     } else if (obj.attachEvent){
        var r = obj.attachEvent("on"+evType, fn);
        return r;
     } else {
        return false;
     }
    }
    function removeEvent(obj, evType, fn, useCapture){
      if (obj.removeEventListener){
        obj.removeEventListener(evType, fn, useCapture);
        return true;
      } else if (obj.detachEvent){
        var r = obj.detachEvent("on"+evType, fn);
        return r;
      } else {
        alert("Handler could not be removed");
      }
    }
  • 相关阅读:
    Pascal's Triangle II
    Pascal's Triangle
    Path Sum II
    Path Sum
    plusOne
    Divide Two Integers
    64. ZigZag Conversion
    63. Swap Nodes in Pairs && Rotate List && Remove Nth Node From End of List
    62. Divide Two Integers
    61. Unique Paths && Unique Paths II
  • 原文地址:https://www.cnblogs.com/Tpf386/p/7834040.html
Copyright © 2011-2022 走看看