tags:

views:

62

answers:

1

Why can the event object have no properties? I get this error in Mozilla Firefox while in IE and Opera all is well.

Please, follow this link to see the problem: here was the link

+3  A: 

EDIT (now that a link is available): the problem is that you are attaching handleMove as the event handler which receives the event argument, then calling documentRelative and attempting to get the event object in there - but you never pass the event argument along.

Change lines 54 and 55 as follows:

function handleMove(e) {
    var documRelative = documentRelative(e);

or move

var e = (e) ? e : window.event;

from documentRelative to the start of handleMove and pass it into documentRelative.

NickFitz
I added a link to the page with the script.
KarlX
I changed (as you can see on the page) lines 54 and 55 but there's no affect.
KarlX
You are also calling documentRelative from elementRelative; you'll have to pass the event object through there, too. I would suggest installing the Firebug extension and using its JS debugger to track these things down.
NickFitz
Thank you very much. It works now. Also, now I understand this whole pass-event thing.
KarlX