By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,817 Members | 2,152 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,817 IT Pros & Developers. It's quick & easy.

Stopping an onMouseDown process when the mouse is up

P: n/a
Hello:

I would like a process to continue as long as the mouse is held down on
a button and to stop as soon as it is released. Something ideally like
this:
"while (ButtonIsDown) {i+ = 1}"

I tried the following in the button tag:

onMouseDown = "isDown = true; while(isDown) {i+=1}"
onMouseUp = "isDown = false"

but the mouseup event does not interrupt the onMouseDown process, so the
loop will continue endlessly.

The same kind of thing happens in the <bodyevents; one will not
interrupt the other.

I would appreciate any suggestions.

st******@optonline.net
Sep 9 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a

stef wrote:
Hello:
Your followup-to field appears to be incorreclty set.
>
I would like a process to continue as long as the mouse is held down on
a button and to stop as soon as it is released. Something ideally like
this:
This thread covers it (seach for "onmousedown is not what I expect"):

<URL:
http://groups.google.com.au/group/co...0937955a293fd3
>

--
Rob

Sep 9 '06 #2

P: n/a
In article <11*********************@p79g2000cwp.googlegroups. com>,
"RobG" <rg***@iinet.net.auwrote:
stef wrote:
Hello:

Your followup-to field appears to be incorreclty set.

I would like a process to continue as long as the mouse is held down on
a button and to stop as soon as it is released. Something ideally like
this:

This thread covers it (seach for "onmousedown is not what I expect"):

<URL:
http://groups.google.com.au/group/co...m/thread/1a5c0
02d226bccaf/ae0937955a293fd3?lnk=gst&q=onmousedown+is+not+what +I+expect+in+Jav
aScript&rnum=1#ae0937955a293fd3

Hello:

Thanks for the information - using the timeout as suggested in the
thread you mention completely solves my problem!

Stef
Sep 12 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.