The $E static object defined below provides cross browser access to all the useful information associated with the latest event. All you need to do is to specify $E.set(e); as the first line of any function that is running in response to an event and all of the properties will then be available in the subsequent processing simply by referencing them from this static object instead of needing to test how the current browser handles it.
This object also provides a way to attach functions to and detach functions from events on specific elements in the web page. It can handle elements either identified directly via their id or alternatively using the $O object associated with the element.
Properties
==========
This static object has no properties.
Methods
=======
set(e) - used to ensure that the $E object is referencing the current event and to extract all the cross browser values into $E.
add(o,t,f) - adds event processing
remove(o,t,f) - removes event processing
The following methods are also available once $E.set(e) has run.
stopProp() - stops the current event propagating to any container element in the page
stopDef() - prevents any default action from being performed.
type() - the type of the event.
element() - the element within the DOM that the event was triggered on.
char() - the character on the keyboard that was pressed to trigger the event.
shift() - true or false to indicate whether the shift key was depressed when the event was triggered.
alt() - true or false to indicate whether the alt key was depressed when the event was triggered.
ctrl() - true or false to indicate whether the ctrl key was depressed when the event was triggered.
left() - true or false to indicate whether the left mouse button was depressed when the event was triggered.
middle() - true or false to indicate whether the middle mouse button was depressed when the event was triggered.
right() - true or false to indicate whether the right mouse button was depressed when the event was triggered.
In the add and remove methods 'o' is the id or $O object, 't' is the type of event (eg. 'click') and 'f' is the function.
|