473,396 Members | 2,029 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

onmousedown and onmouseup while dragging: What am I doing wrong?

I am trying to let the user drag a rectangle over an image, which will
then let the user zoom in on the dragged area. However, I am doing
something wrong in implementing the onmousedown and onmouseup events.

Everything is very simple so far. I just defined an onMouseDown event to
record the event's x and y locations as the starting point, and an
onMouseUp event to record the x and y of the end point, and this function
gives me the results of both in an alert box.

The problem is, that the OnMouseUp event does not get fired if I move the
mouse while holding the left button down. This only works if I click down
and then up at the same point, which is not what I want.

What could be wrong? Why does the browser not recognize the mouse up when
the mouse is moved while holding the left button down? How do I fix this?

Thanks,
Steve
Jul 23 '05 #1
1 2436
On Sun, 15 May 2005 20:17:23 +0200, coolsti wrote:

I guess I can answer my own question. I found out the problem.

It seems that when doing this trick over an image, I need to tell the
browser not to do its standard thing when the mouse is moved with the left
button pressed. To do this I needed to have
onMouseMove="myFunction();return false;" instead of what I had before,
onMouseMove="myFunction()"

Otherwise the browser cancelled the mouse event after moving the mouse
more than xxx pixels.

steve
Jul 23 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: sameth | last post by:
I wrote a script that uses onmousedown and onmouseup in javascript that works great in ie and firefox on windows2000. It looks as if the pocketpc 2003 ie browser dosn't support onmousedown or...
6
by: Giggle Girl | last post by:
Hi there! I am trying to get a web app for our intranet (IE 6+ only) to have a similar behavior to MS Excel, where you can "drag" in between Column Headers to resize them. See an online demo...
6
by: RC | last post by:
<a href="#" onmousedown="callMyFunction()">Press the mouse button</a> What I expect is when I or an user move mouse pointer over that link, and press the mouse button. Then will...
3
by: atn2002 | last post by:
I'm trying to create a control which when the mouse button gets pressed on one div an absolute positioned div pops up in place of the cursor. From there the cursor should interact with the dialog...
9
by: jon | last post by:
Hello, I'm trying to experiment with some javascript to do some custom dragdrop handling. I wish to use the onMouseDown event to trigger the start of my drag, and onMouseup for a potentential...
1
by: NeilCarmichael | last post by:
I am flummoxed, I'm relatively new to javascript and I can't get my onmousedown onmouseup script to work. simply, I want to fire one function when I click down on a graphic and a second when I...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.