{"id":667,"date":"2017-03-03T15:10:21","date_gmt":"2017-03-03T07:10:21","guid":{"rendered":"http:\/\/www.qdabc.cn\/?p=667"},"modified":"2017-03-03T14:54:56","modified_gmt":"2017-03-03T06:54:56","slug":"%e9%80%9a%e7%94%a8%e7%9a%84%e4%ba%8b%e4%bb%b6%e4%be%a6%e5%90%ac%e5%99%a8%e5%87%bd%e6%95%b0","status":"publish","type":"post","link":"http:\/\/www.qdabc.cn\/?p=667","title":{"rendered":"\u901a\u7528\u7684\u4e8b\u4ef6\u4fa6\u542c\u5668\u51fd\u6570"},"content":{"rendered":"<p>\u4e8b\u4ef6\u76d1\u542c\u51fd\u6570\uff0c\u80fd\u517c\u5bb9ie\u548c\u975eie\u6d4f\u89c8\u5668<\/p>\n<pre class=\"brush:js;toolbar:false\">markyun.Event = {\r\n    \/\/ \u9875\u9762\u52a0\u8f7d\u5b8c\u6210\u540e\r\n    readyEvent : function(fn) {\r\n        if (fn==null) {\r\n            fn=document;\r\n        }\r\n        var oldonload = window.onload;\r\n        if (typeof window.onload != 'function') {\r\n            window.onload = fn;\r\n        } else {\r\n            window.onload = function() {\r\n                oldonload();\r\n                fn();\r\n            };\r\n        }\r\n    },\r\n    \/\/ \u89c6\u80fd\u529b\u5206\u522b\u4f7f\u7528dom0||dom2||IE\u65b9\u5f0f \u6765\u7ed1\u5b9a\u4e8b\u4ef6\r\n    \/\/ \u53c2\u6570\uff1a \u64cd\u4f5c\u7684\u5143\u7d20,\u4e8b\u4ef6\u540d\u79f0 ,\u4e8b\u4ef6\u5904\u7406\u7a0b\u5e8f\r\n    addEvent : function(element, type, handler) {\r\n        if (element.addEventListener) {\r\n            \/\/\u4e8b\u4ef6\u7c7b\u578b\u3001\u9700\u8981\u6267\u884c\u7684\u51fd\u6570\u3001\u662f\u5426\u6355\u6349\r\n            element.addEventListener(type, handler, false);\r\n        } else if (element.attachEvent) {\r\n            element.attachEvent('on' + type, function() {\r\n                handler.call(element);\r\n            });\r\n        } else {\r\n            element['on' + type] = handler;\r\n        }\r\n    },\r\n    \/\/ \u79fb\u9664\u4e8b\u4ef6\r\n    removeEvent : function(element, type, handler) {\r\n        if (element.removeEnentListener) {\r\n            element.removeEnentListener(type, handler, false);\r\n        } else if (element.detachEvent) {\r\n            element.detachEvent('on' + type, handler);\r\n        } else {\r\n            element['on' + type] = null;\r\n        }\r\n    }, \r\n    \/\/ \u963b\u6b62\u4e8b\u4ef6 (\u4e3b\u8981\u662f\u4e8b\u4ef6\u5192\u6ce1\uff0c\u56e0\u4e3aIE\u4e0d\u652f\u6301\u4e8b\u4ef6\u6355\u83b7)\r\n    stopPropagation : function(ev) {\r\n        if (ev.stopPropagation) {\r\n            ev.stopPropagation();\r\n        } else {\r\n            ev.cancelBubble = true;\r\n        }\r\n    },\r\n    \/\/ \u53d6\u6d88\u4e8b\u4ef6\u7684\u9ed8\u8ba4\u884c\u4e3a\r\n    preventDefault : function(event) {\r\n        if (event.preventDefault) {\r\n            event.preventDefault();\r\n        } else {\r\n            event.returnValue = false;\r\n        }\r\n    },\r\n    \/\/ \u83b7\u53d6\u4e8b\u4ef6\u76ee\u6807\r\n    getTarget : function(event) {\r\n        return event.target || event.srcElement;\r\n    },\r\n    \/\/ \u83b7\u53d6event\u5bf9\u8c61\u7684\u5f15\u7528\uff0c\u53d6\u5230\u4e8b\u4ef6\u7684\u6240\u6709\u4fe1\u606f\uff0c\u786e\u4fdd\u968f\u65f6\u80fd\u4f7f\u7528event\uff1b\r\n    getEvent : function(e) {\r\n        var ev = e || window.event;\r\n        if (!ev) {\r\n            var c = this.getEvent.caller;\r\n            while (c) {\r\n                ev = c.arguments[0];\r\n                if (ev &amp;&amp; Event == ev.constructor) {\r\n                    break;\r\n                }\r\n                c = c.caller;\r\n            }\r\n        }\r\n        return ev;\r\n    }\r\n};<\/pre>\n<p class=\"post-copyright\">\u6b22\u8fce\u5206\u4eab\u672c\u6587\uff0c\u8f6c\u8f7d\u8bf7\u4fdd\u7559\u51fa\u5904\uff1a<a href=\"http:\/\/www.qdabc.cn\">\u524d\u7aefABC<\/a> &raquo; <a href=\"http:\/\/www.qdabc.cn\/?p=667\">\u901a\u7528\u7684\u4e8b\u4ef6\u4fa6\u542c\u5668\u51fd\u6570<\/a><\/p>","protected":false},"excerpt":{"rendered":"<p>\u4e8b\u4ef6\u76d1\u542c\u51fd\u6570\uff0c\u80fd\u517c\u5bb9ie\u548c\u975eie\u6d4f\u89c8\u5668 markyun.Event = { \/\/ \u9875\u9762\u52a0\u8f7d\u5b8c\u6210\u540e readyEvent : function(fn) { if (fn==null) { fn=docu [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":115,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[168],"_links":{"self":[{"href":"http:\/\/www.qdabc.cn\/index.php?rest_route=\/wp\/v2\/posts\/667"}],"collection":[{"href":"http:\/\/www.qdabc.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.qdabc.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.qdabc.cn\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.qdabc.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=667"}],"version-history":[{"count":1,"href":"http:\/\/www.qdabc.cn\/index.php?rest_route=\/wp\/v2\/posts\/667\/revisions"}],"predecessor-version":[{"id":668,"href":"http:\/\/www.qdabc.cn\/index.php?rest_route=\/wp\/v2\/posts\/667\/revisions\/668"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/www.qdabc.cn\/index.php?rest_route=\/wp\/v2\/media\/115"}],"wp:attachment":[{"href":"http:\/\/www.qdabc.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=667"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.qdabc.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=667"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.qdabc.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=667"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}