Mouse movement while a button is pressed

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Jeroni Paul

    Mouse movement while a button is pressed

    <BODY onmousemove="re turn false;" oncontextmenu=" return false;">
    <IMG src="button.gif " onmouseover="th is.src='down.gi f'"
    onmouseout="thi s.src='button.g if'">
    </BODY>

    This simple example shows where my problem is. It works fine when all
    mouse buttons are released, and also if a button is pressed outside
    the image. But if a button is pressed inside the picture it'll not
    call onmouseout when the mouse is brought outside the picture. The
    worst is it'll never call it, leaving the button stuck pressed forever
    until mouse is moved over it again.
    I just noticed if I place the picture inside an A tag it does work
    fine then, but I don't need an A element here. Moreover, this fix
    appears to work only for IE6, IE4 still doesn't work properly.
    I'm asking if there's some other way to correct this. I'm also making
    this compatible with Netscape 4.5, and the presence of an A element
    changes the event.target.
    The fact is I can't seem to disable the default drag'n drop of IE with
    pictures. Netscape 4.5 appears to work perfectly. By placing
    onmousemove="re turn false;" in BODY I aboid the cursor change in IE
    but nothing else.

    Thank you for any idea.
  • Janwillem Borleffs

    #2
    Re: Mouse movement while a button is pressed


    "Jeroni Paul" <JERONI.PAUL@te rra.es> schreef in bericht
    news:6c768c09.0 309041118.2e574 584@posting.goo gle.com...[color=blue]
    >
    > This simple example shows where my problem is. It works fine when all
    > mouse buttons are released, and also if a button is pressed outside
    > the image. But if a button is pressed inside the picture it'll not
    > call onmouseout when the mouse is brought outside the picture. The
    > worst is it'll never call it, leaving the button stuck pressed forever
    > until mouse is moved over it again.[/color]

    Try it with the onmousedown/onmouseup event handlers:

    <IMG src="button"
    onmousedown="sr c='down.gif'"
    onmouseup="src= 'up.gif'"[color=blue]
    >[/color]

    Alternatively, you can throw in the onmouseover/out handlers as well...

    JW



    Comment

    Working...