<script type="text/javascript">
var EventUtil = {
addHandler: function (oElement, sEvent, fnHandler) {
oElement.addEventListener ? oElement.addEventListener(sEvent, fnHandler, false) : oElement.attachEvent("on" + sEvent, fnHandler)
},
removeHandler: function (oElement, sEvent, fnHandler) {
oElement.removeEventListener ? oElement.removeEventListener(sEvent, fnHandler, false) : oElement.detachEvent("on" + sEvent, fnHandler)
},
addLoadHandler: function (fnHandler) {
this.addHandler(window, "load", fnHandler)
}
}
</script>
泉源:http://fgm.cc/learn/lesson4/08.html