function addEvent(obj, type, handle) { if (obj.addEventListener) { obj.addEventListener(type, handle); } else if (obj.attachEvent) { obj.attachEvent('on' + type, handle); } } function removeEvent(obj, type, handle) { if (obj.removeEventListener) { ob…