Closed
Bug 67263
Opened 25 years ago
Closed 25 years ago
onmousemove not creating event object
Categories
(Core :: DOM: Events, defect)
Tracking
()
VERIFIED
FIXED
People
(Reporter: gregory, Assigned: jst)
References
()
Details
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; m18) Gecko/20010131
BuildID: 2000013106
Build 2000013004 works with this page. Build 2000013106 does not.
I tried changing the onmousemove event function to:
function mousemove(){
}
Which worked with IE5.5 but not Mozilla 20000131. I am not sure which is the
correct syntax, but now nothing seems to work with mozilla.
Reproducible: Always
Steps to Reproduce:
1.Go to the URL
2.Click on the title bar "Today's News" and drag.
Actual Results: The "table dialog" does not move.
Expected Results: The window should be draggable, but it just sits there.
Install Mozilla 20000130 and it will work. Remove the "event" paramater from
mousemove and mousedown and it will work in IE5.5.
How exactly is this function supposed to be called with or without the event
object as a paramater?
Greg, this seems to be a programming problem rather then a Mozilla bug, but
please try this:
function mousedown ( evt ) {
var myEvent = evt; /* Store NN events */
if ( document.all ) myEvent = event; /* store IE events */
if ( table_mouse == 1 ) {
vartmp = document.getElementById("counter").style.left;
vartmp2 = vartmp.replace("px", "");
document.getElementById("a1").innerHTML = table_mouse;
varmousedown=myEvent.clientX-vartmp2;
document.getElementById("counter").style.left = myEvent.clientX-varmousedown;
document.getElementById("counter").style.top = myEvent.clientY-10;
}
}
I didn't test this, because I copy/pasted it in the tiny little Bugzilla comment
box and then changed it.
Goodluck!
| Reporter | ||
Comment 3•25 years ago
|
||
Ok, this is getting odd. I confirmed that the link did not work with:
2000013006 - Win2000
2000013006 - Linux
However, it is working with:
2000013006 - WinNT
Thanks for the code, that is probably the best way around the problem of IE
auto creating an event object and Mozilla needing the object passed. I should
not have confused the issue of working both with IE and Mozilla. I will test
your code on 2000013006 - Win2000 tonight, but other than IE support, the
Mozilla bits look identical to mine.
Remember, in MSIE you can use event in your functions, but not in Mozilla.
And also note that you need to pass that event in Mozilla. For example:
document.onmousedown = mousdown(evt);
| Assignee | ||
Comment 5•25 years ago
|
||
H-J, document.onmousedown = mousdown(evt); is not what you wanto do, that will
set document.onmousedown to the returnvalue of calling "mosedown(evt);" at the
time when you're setting the event handler.
In mozilla an 'event' argument is always passed as the first argument to the
event handler so if you're dynamically setting the event handler you'd wanto do
something like this:
function eventHandler(e)
{
alert(e);
]
document.onclick=eventHandler;
This will work in mozilla, and if you rename the argument 'e' in the
eventHandler function to 'event' it will also work in IE since 'event' will
resolve to window.event in IE (which is just wrong, but that's how it works).
If you're setting the event handler in your HTML, something like this:
<p onclick="foo(event);">
Then the script 'foo(event);' is your event handler, not the function foo, so
you'll haveto pass in the event argument as the first argument to the function
that is called by your event handler, and again, if you name that argument
'event' in your 'foo' method it'll work in both IE and Mozilla/NN6.
| Reporter | ||
Comment 6•25 years ago
|
||
I just checked this bug against the new nightly 20000201 on Win2000, Linux and
WinNT and the above URL is working again.
Johnny Stenback, if you look at my code at the above URL, I did use foo(event),
but IE5.5 did not like that since it seemed to refuse to pass the event as an
argument. Maybe I am not understanding you correctly. Could you provide a
simple full piece of code? I know this bug is fixed now, but I would like to
know if I could get this to work in both IE and Mozilla without any browser
detection. Thanks.
Marking Fixed.
Status: UNCONFIRMED → RESOLVED
Closed: 25 years ago
Resolution: --- → FIXED
>H-J, document.onmousedown = mousdown(evt); is not what you wanto do, that will
>set document.onmousedown to the returnvalue of calling "mosedown(evt);" at the
?time when you're setting the event handler.
Johnny, this is just a stupid example. Don't ask me where that came from. Did a
copy/paste out of the source, and was trying to say that he needs to pass an
event, as I did in my comment. The whole part about setting a new eventHandler
is gone!
Updated•25 years ago
|
Component: DOM Level 1 → DOM Events
Updated•25 years ago
|
QA Contact: janc → vladimire
Comment 8•25 years ago
|
||
QA Contact Update
You need to log in
before you can comment on or make changes to this bug.
Description
•