Gérard Talbot <ne***********@gtalbot.org> wrote in message news:3m*************@uni-berlin.de...
Stephen Chalmers wrote : scot_nery <sc**@juggle.com> wrote in message news:11**********************@g44g2000cwa.googlegr oups.com...
var mouseX, mouseY;
function getMousePos(e)
{
if (!e)
var e = window.event||window.Event;
This manner of coding is not recommendable, IMO. In javascript strict
mode (reporting warnings), Firefox will report that "variable e hides
argument". This manner of coding just makes debugging more difficult.
That level of warning is intended to advise of possible pitfalls, not errors. I know that if I choose conditionally to
overwrite a passed parameter, then I must be aware that any initial value may be lost.
if('undefined'!=typeof e.pageX)
{
mouseX = e.pageX;
mouseY = e.pageY;
}
else
{
mouseX = e.clientX + document.body.scrollLeft;
This will work in MSIE 5 but what if the document triggers standards
compliant mode in MSIE 6?
That can happen only if the programmer brings it about, in which case he will know what to expect and amend the code
accordingly. I didn't want to clutter my demonstration with the cascade of questions that must be asked to cover that
contingency.
// You need to tell Mozilla to start listening:
if(window.Event && document.captureEvents)
document.captureEvents(Event.MOUSEMOVE);
Why not register the listener to the object with DOM 2 Events method?
It's forward-compatible. Future-proof.
Here I must bow to your clairvoyancy, however I don't seem to know the syntax for making it past-proof, which remains a
concern. On the planet where all users upgrade at the first opportunity, your advice may be of some value, but not where
I reside.
--
Stephen Chalmers
547265617375726520627572696564206174204F2E532E2072 65663A205451323437393134