There are only three keys on the keyboard that can be used as event modifiers because they are the only keys on the keyboard where JavaScript provides a means of telling if the key is being held down while another action is taking place.
If you think about it this makes sense since most of the keys on the keyboard are designed to send a single character to the computer when the key is first pressed (and will usually start sending a series of the same character if you keep the key depressed). As such those key presses happen and trigger an event of their own and that event occurs either before or after the event that you are trying to modify.
The three keys that you can use to modify an event are the same three keys that you can use to modify the meaning of the other keys on your keyboard. These three keys are Shift, Alt, and Ctrl. not all computes have all three of these and the keys may even be labelled differently on the keyboard itself but these are the names that JavaScript uses for these modifier keys on your keyboard regardless of what they are actually labelled as on your keyboard itself.
In all three cases the browser makes a Boolean value available that we can test to see if any (or all) of these three keys are depressed when an event occurs. These values are true when the key is depressed and false when it is not.
Since Internet Explorer provides a different mechanism for accessing events to other browser the code we need is not quite as straightforward as it would be if IE followed the standards but we don't need a huge amount of extra code to make this work.
$M = function(e) {
evt = (event)?event:e;
return {shiftKey: evt.shiftKey, altKey: evt.altKey, ctrlKey: evt.ctrlKey};
}
With that code in place we can then test for the shift key being depressed during an event using:
if($M().shiftKey)
To test if both the Ctrl and Alt keys are depressed during the event we would test:
var m = $M();
if (m.ctrlKey && m.altKey)
