473,795 Members | 2,410 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Detecting onmouseup outside browser window?

If I perform a mousedown within a document, move the mouse outside the
browser window, and then release the mouse button, the document.onmous eup
event does not fire. Is there any way to detect a mouseup event outside the
document?

Also, how can I get the relative coordinates of the cursor while it is
outside the browser?

Thank you.
Jul 23 '05
20 7940
Mandy Memphis wrote:

<--snip-->

When I see code like this:

href="javascr ipt:void(0)"

I tend to stop reading anymore, as the author code such as that isn't
very aware of reality on the web.

He was aware enough to get something to work that you said couldn't be done!
;-P


No, because it doesn't work.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javas cript FAQ - http://jibbering.com/faq/
Jul 23 '05 #11
Matt Kruse wrote:
Randy Webb wrote:
When I see code like this:
href="javascr ipt:void(0)"
I tend to stop reading anymore, as the author code such as that isn't
very aware of reality on the web.

I don't think that's a fair statement.
Obviously, Mr. Zorn is not a newbie script kiddie, and to be so judgemental
of his abilities based on a snippet of code is a bit unwarranted, IMO.


No, he is not a newbie script kiddie, but I still tend to discount code
written that has snippets of that in it. I also tend to discount code
that has attempted obfuscation in it, and thats based on his .js file.
--
Randy
Chance Favors The Prepared Mind
comp.lang.javas cript FAQ - http://jibbering.com/faq/
Jul 23 '05 #12
"Randy Webb" <hi************ @aol.com> wrote in message
news:7o******** ************@co mcast.com...
Mandy Memphis wrote:

<--snip-->

When I see code like this:

href="javascr ipt:void(0)"

I tend to stop reading anymore, as the author code such as that isn't
very aware of reality on the web.

He was aware enough to get something to work that you said couldn't be done! ;-P


No, because it doesn't work.


Work for me.
Jul 23 '05 #13
On Tue, 6 Jul 2004 21:40:04 -0400, Mandy Memphis wrote:
No, because it doesn't work.


Work for me.


The natural assumption on this group is that you
are developing for the web unless otherwise stated.

On the web, it does not work. ( Note that you
have already had a 50% failure rate in the
4 tests conducted. )

--
Andrew Thompson
http://www.PhySci.org/ Open-source software suite
http://www.PhySci.org/codes/ Web & IT Help
http://www.1point1C.org/ Science & Technology
Jul 23 '05 #14
Andrew Thompson wrote:
The natural assumption on this group is that you
are developing for the web unless otherwise stated.
On the web, it does not work. ( Note that you
have already had a 50% failure rate in the
4 tests conducted. )


It would be more correct to say that on the web, it does not work with all
browsers, but most likely does work for the majority of users. Also, it
appears to degrade gracefully (not causing any problems in browsers where it
doesn't work) which is exactly what we'd want.

So, in summary, it appears to be a fantastic solution, IMO.

--
Matt Kruse
Javascript Toolbox: http://www.JavascriptToolbox.com/
Jul 23 '05 #15
On Wed, 7 Jul 2004 11:14:37 -0500, Matt Kruse wrote:
..50% failure rate in the
4 tests conducted.


It would be more correct to say that on the web, it does not work with all
browsers, but most likely does work for the majority of users. Also, it
appears to degrade gracefully (not causing any problems in browsers where it
doesn't work) which is exactly what we'd want.


Doesn't have the same ring to it as..
"50% failure rate in the 4 tests conducted."
...which is an accurate statement.

--
Andrew Thompson
http://www.PhySci.org/ Open-source software suite
http://www.PhySci.org/codes/ Web & IT Help
http://www.1point1C.org/ Science & Technology
Jul 23 '05 #16
Andrew Thompson wrote:
Doesn't have the same ring to it as..
"50% failure rate in the 4 tests conducted."
..which is an accurate statement.


a) Flawed statistics are meaningless. "100% success rate in the browsers
used by 94% of site visitors" is another statistic which might be accurate.
b) Every single javascript every written will fail in at least one situation
c) It doesn't really matter, since the solution does exist, works nicely in
a subset of browsers, and degrades gracefully - everything js code should
do. :)

--
Matt Kruse
Javascript Toolbox: http://www.JavascriptToolbox.com/
Jul 23 '05 #17
Matt Kruse wrote:
Andrew Thompson wrote:
The natural assumption on this group is that you
are developing for the web unless otherwise stated.
On the web, it does not work. ( Note that you
have already had a 50% failure rate in the
4 tests conducted. )
It would be more correct to say that on the web, it does not work
with all browsers,


Surly it does not work with all browser whether on the web or not. The
web is just the place where it can expect to encounter all browsers (or
at least stand a chance of encountering them).
but most likely does work for the majority of
users. Also, it appears to degrade gracefully (not causing any
problems in browsers where it doesn't work) which is exactly what
we'd want.
Well, we have a thread about monitoring the mouseup event outside of the
window/document, and that definitely does not work on many browsers, and
then only under some circumstances (only when dragging in IE, for
example).

The code under discussion does make a reasonable attempt at clean
degradation, but it is a long way from being cross-browser, reliable or
good. And some of the implementation details make me think that it could
be extremely problematic on Safari or Konqueror (to name but two) with
the script partly running and then erroring mid process due to the use
of object-inference browser detection instead of the feature detection
that it almost achieves. That type of uncontrolled failure mid flow is
likely to undo the good work put into clean degradation by leaving the
page in an intermediate state that may not be nearly as viable as the
original HTML.
So, in summary, it appears to be a fantastic solution, IMO.


If you understood what the script was doing you would not be attaching
"fantastic" to it as a label. It is an above average script with some
serious design flaws and as a result should only be expected to exhibit
planned behaviour on the limited test-set of browsers stated in its
documentation.

It is actually a bit disappointing as a product of its author as his
vector graphics library is a really good implementation of efficient
line and arc drawing algorithms in javascript. Which contrasts horribly
with a script that even features an eval-ed dot notation property
accessor.

Richard.
Jul 23 '05 #18
"Randy Webb" <hi************ @aol.com> wrote in message
news:7o******** ************@co mcast.com...
Matt Kruse wrote:
Randy Webb wrote:
When I see code like this:
href="javascr ipt:void(0)"
I tend to stop reading anymore, as the author code such as that isn't
very aware of reality on the web.

I don't think that's a fair statement.
Obviously, Mr. Zorn is not a newbie script kiddie, and to be so judgemental of his abilities based on a snippet of code is a bit unwarranted, IMO.


No, he is not a newbie script kiddie, but I still tend to discount code
written that has snippets of that in it. I also tend to discount code
that has attempted obfuscation in it, and thats based on his .js file.


I'm not sure if he has deliberately obfuscated it, but it isn't very clear,
that's for sure. His attitude seems to be "why do something in 10 lines when
you can do it all in one", and "why name something intuitively when you can
use two random letters". Maybe it's because he's German? :) However, it
seems to work well in IE anyway. As for Mandy's problem...

In IE you can capture the document.onmous eover event and return false from
it in order to cancel the default action (which is to stop updatng the mouse
coords beyond the window boundary). The mouse coords can then be read from
the event.clientX and event.clientY properties. Another side effect of doing
this is that the document.onmous eup event will now fire while the mouse is
outside the browser (while the browser is active). Note that setting the
event.cancelBub ble property in the document.onmous eover event is independent
of cancelling the default action.

HTH
Jul 23 '05 #19
Matt Kruse wrote:
Andrew Thompson wrote:
Doesn't have the same ring to it as..
"50% failure rate in the 4 tests conducted."
..which is an accurate statement.
a) Flawed statistics are meaningless. "100% success rate in the browsers
used by 94% of site visitors" is another statistic which might be accurate.


His statistics aren't flawed. His choice of tests or his testing methodology
might be, causing him to get the failure rate he desires, but the statistics
themselves are (presumably) accurate. Of the four tests he chose to conduct, the
page failed half the time. The trick lies in finding the right four tests to
use.
b) Every single javascript every written will fail in at least one situation
This depends on how you define "failure". If the code never executes, then can
it be considered to have "failed".

I doubt <script type="text/javascript">var n = 0;</script> has ever failed in at
least one situation, unless you define failure to include not executing at all
(in the case of a user agent which does not support JavaScript, or JavaScript is
not enabled).
c) It doesn't really matter, since the solution does exist, works nicely in
a subset of browsers, and degrades gracefully - everything js code should
do. :)


I right-clicked the links in question and chose "Open Link in New Active Tab". I
got a blank document. Not too graceful a degradation.

I'm not particularly sure what would be so terribly wrong with:

<a href="noJS.html " onclick="...;re turn false;">...</a>

with noJS.html:

<html>
<head>
<title>JavaScri pt not enabled or link not single clicked</title>
</head>
<body>
<p>You need JavaScript enabled to enjoy what this link does. Be sure to single
click the link with your primary mouse button to activate it.</p>
</body>
</html>

Simple to implement, does not require much more work then <a
href="javascrip t:void(0);" ...> and would avoid silly arguments on usenet.

--
Grant Wagner <gw*****@agrico reunited.com>
comp.lang.javas cript FAQ - http://jibbering.com/faq
Jul 23 '05 #20

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

Similar topics

10
4123
by: Frances Del Rio | last post by:
pls, why is this not working? <SCRIPT language=JavaScript type="text/javascript"> var br = '<SCRIPT language=Javascript' br += 'src="js_pop.js" type="text/javascript">' br += '</SCRIPT>' var op = '<SCRIPT language=Javascript' op += 'src="js_pop-op.js" type="text/javascript">' op += '</SCRIPT>' if (navigator.userAgent.indexOf('Opera') != -1 ) {
2
5792
by: David Wake | last post by:
I am a complete Javscript newbie trying to produce a user interface similar to Google Maps -- the user should be able to click anywhere on the map and drag it in any direction. The Javascript works OK when the map is only dragged a few pixels. If the map is dragged any significant distance, however, the cursor changes to a document-like icon (in Firefox 1.5) or a circle with a line through it (in IE 5) and no onMouseUp event is fired on...
79
3799
by: VK | last post by:
I wandering about the common proctice of some UA's producers to spoof the UA string to pretend to be another browser (most often IE). Shouldn't it be considered as a trademark violation of the relevant name owner? If I make a whisky and call it "Jack Daniels", I most probably will have some serious legal problems. "Mozilla" partially appeared because NCSA stopped them from using "Mosaic" in the UA string. Is it some different...
5
13699
by: Dag Sunde | last post by:
Is it possible to detect if the user minimizes the browser-window? I do some polling, and want to stop it while the window in minimized, but not when it only is blurred... TIA... -- Dag.
3
1551
by: mk | last post by:
Hi I'v got the following javascript (part of it) that works with the event onmouseup: // Attach event handlers to all images within container LICollection=document.getElementById("MDME").getElementsByTagName("LI"); if (LICollection!=null) { for (l=0; l<LICollection.length; l++) {LICollection.item(l).onmouseup=onMouseUpHandler;}
1
3063
by: Jason | last post by:
I am creating a Comet/Ajax chatroom system. When people go to the page, it will add them to the list of people in the room via window.onload. When they leave, disconnect, go to another page, or close browser, I need to remove them from the room. I use window.onbeforeunload, but it seems it doesn't always fire. IE & firefox will only unload sometimes - sometimes I think maybe its caching the page, and not calling onbeforeunload (my...
9
7604
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 drop. I hope to turn on the onmouseup only in onmousedown. And eventually go one step further and incorporate onmousemove for a true drag workflow. I'm running into a problem however, where after mousedown, mouseup will not fire when I release...
1
2321
by: Mango | last post by:
I'm trying to print some text in a very specific position on a page, so that it will show through the window of an envelope when folded. This is easy to do, as long as the browser's print margins are set to 0, or I subtract the width of the margins from the position of the text. My question is: is there a technique for detecting browser print margins? It'd be nice not to have to warn users to set them to something specific.
11
3478
by: yawnmoth | last post by:
http://www.frostjedi.com/terra/scripts/demo/onmouseup.html In Firefox, if I click in the black box and then release, I get a popup. If I click, drag the cursor, and then release, I don't. Similarly, if I click and then release outside of the black box, I don't get a popup, and I don't understand why. If I comment out "document.getElemenById("demo").onmousedown = mousedown;", it works. Why would that make a difference?
0
9519
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10437
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10214
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10001
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7538
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6780
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5437
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5563
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2920
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.