Attached is a quick function I wrote for one of my various started but unfinished projects.  After as much research as I could bear, I was able to figure out how to at least make the following properties avaliable (renamed to be better consistent with what I was doing and to avoid confusion with current event objects):

.altKey
.ctrlKey
.shiftKey
(meta key isn't supported on some browsers)

.keyCode
.keyChar
.rightMouse 
(unfortunately it is very error prone and frankly not worth the overhead to set up detection of the other buttons due to horrible inconsistencies between DOM and IE)

.target

(page relative coordinates)
.pageX
.pageY
(screen relative coordinates)
.screenX
.screenY
(layer relative coordinates)
.offsetX
.offsetY

.type

Also note that I was toying around with the idea of type-specific events (mouse, keyboard, etc), but it seems to be far more efficient to just return an object that is identical for any type of event.

Anyway, this is pretty trimmed down (but still as large as I could made it), but for all my uses so far it was more than sufficient.  Read this if you haven't:  http://www.quirksmode.org/js/events_properties.html

--
-Ian MacLeod

Attachment: events.js
Description: JavaScript source

Reply via email to