walt wrote:
Well fantastic. I am very grateful and shall be using your version.
But, what does this mean:
var event e || window.event;
which is what I have used as apposed to:
if (!e) var e = window.event;
your version.
The top version is a short cut really, the end result is the same for both.
The first version is saying "create a variable called 'event' and assign
it the value of the variable 'e', if that variable has a value, or the
value of 'window.event', if that has a value. If both variables have a
value then 'e' will be used as that comes first. The '||' means or but
you probably know that.
The second version is saying "If the variable 'e' does not have a value
(the '(!e)' bit) then create a variable e and assign it the value of
'window.event'.
When I say "has a value" I mean that the variable is initialised and has
a value other than null, false or 0. In Javascript such a value is
considered logically 'true', with null, false or 0 being considered
'false'. Many other programming languages use a similar idea, C being
the most well known.
Either version will work, although personally, I would use the second
one as it's a bit clearer.