zoukankan      html  css  js  c++  java
  • 模式-初始化分支

    var MYAPP = {};
    MYAPP.event = {
        addListener: null,
        removeListener: null
    };

    if (typeof window.addEventListener === 'function') {
        MYAPP.event.addListener = function(el, type, fn) {
            el.addEventListener(type, fn, false);
        };
        MYAPP.event.removeListener = function(el, type, fn) {
            el.removeListener(type, fn, false);
        }
    } else if (typeof window.attachEvent === 'function') {
        MYAPP.event.addListener = function(el, type, fn) {
            el.attachEvent('on' + type, fn);
        };
        MYAPP.event.removeListener = function(el, type, fn) {
            el.detachEvent('on' + type, fn);
        };
    } else {
        MYAPP.event.addListener = function(el, type, fn) {
            el['on' + type] = fn;
        };
        MYAPP.event.removeListener = function(el, type, fn) {
            el['on' + type] = null;
        };
    };

  • 相关阅读:
    Java 分支结构
    Java 循环结构
    Java 运算符
    Java 修饰符
    Alpha冲刺——Day 6
    Alpha冲刺——Day 5
    Alpha冲刺——Day 4
    Alpha冲刺——Day 3
    Alpha冲刺——Day 2
    Alpha冲刺——Day 1
  • 原文地址:https://www.cnblogs.com/Alan2016/p/6674615.html
Copyright © 2011-2022 走看看