Click to See Complete Forum and Search --> : no event fired on onmouseup


Tobias
11-05-2004, 06:40 AM
Hi!

I have an html image-element that looks like this:
<img
onmousedown="MDownMap ();"
onmouseup="MUpMap ();"
onmousemove="MMoveMap ();"
id="transPic"
style="position:absolute; top:0; left:0; width:630; height:482; visibility:visible; z-index:3; cursor:crosshair;"
src="img/transPix.gif">

The corresponding JavaScript functions are these:
function MDownMap () {mouseDown=true;}
function MUpMap () {mouseDown=false;}
function MMoveMap () {status=mouseDown;}

The onmousemove event fires when i move the cursor over the image and the word "false" can be read in the status bar (IE). The onmousedown event fires when i press the mouse button and the word "true" can be read in the status bar. But when I release the mouse button, after having moved the cursor around with the button down, the status bar still reads "true" which i suppose means the onmouseup event hasn't fired. When I don't move the mouse around while the button is pressed it works just fine.

Does anyone know what's wrong? (I've done a similar thing using SVG instead of HTML and then I didn't encounter this problem)

Regards

Tobias Lennartsson

Tobias
11-05-2004, 08:25 AM
I found the solutiuon:
on mousedown on an img element the browser tries to let the user drag and drop the image so now I use an input element (type="image") instead

/Tobias

7stud
11-05-2004, 08:43 AM
None of the behavior you describe is exhibited by the code you posted. :confused:

Tobias
11-05-2004, 09:07 AM
It probably depends on which browser you use, browser settings, if you have a valid url for a picture in the img element and so on. The problem is solved however. Thanks for the interest shown.
/Tobias