More compatible ways of adding and removing events on elements.

It's not quite as complete a solution as what jQuery provides, but it works.

(jQuery's solution is here: https://github.com/jquery/jquery/blob/master/src/event.js)