I'm aware of things like onchange
, onmousedown
and onmouseup
but is there a good reference somewhere that lists all of them complete with possibly a list of the elements that they cover?
5 回答
W3Schools seems to have a good Javascript events reference: HTML DOM Events
Quirksmode has a nice event-compatibility table and an introduction.
Here is a pretty good JavaScript event reference with the elements they are for:
JavaScript Tutorial >> JavaScript Events
This Javascript Cheat Sheet has a complete list of of event handlers. Nearly all of them can be used on any html element except for one or two.
If you want to use a lightweight javascript library, DOMAssistant is very lightweight and allows you to add events to elements very easily. Like so:
$("#navigation a").addEvent("click", myFunc);
If you're going to be working with events (setting custom functions and event handlers), then I'd recommend checking out the jQuery library. It makes event binding so much easier than doing it by hand.