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

document-wide disable of mousedown

P: n/a
PJ6
AJAX is great but I'd like to prevent users from clicking anything again and
causing more actions to happen while the server is working on the current
request without changing the contents of the page. I already set the pointer
to a wait cursor.

What's the best way to disable OnMouseDown document-wide?

Paul
Jan 31 '06 #1
Share this Question
Share on Google+
9 Replies


P: n/a
PJ6 wrote on 31 jan 2006 in comp.lang.javascript:
AJAX is great but I'd like to prevent users from clicking anything
again and causing more actions to happen while the server is working
on the current request without changing the contents of the page. I
already set the pointer to a wait cursor.

What's the best way to disable OnMouseDown document-wide?


Polyurethane foam?

It is your page, so, fix your clientside script.

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jan 31 '06 #2

P: n/a
PJ6
"Evertjan." <ex**************@interxnl.net> wrote in message
news:Xn********************@194.109.133.242...
What's the best way to disable OnMouseDown document-wide?


Polyurethane foam?

It is your page, so, fix your clientside script.


This is the very reason I hate JavaScript. In order to derive a global
behavior I have to change every last godforsaken element that uses
JavaScript. I acknoweldge that some ways are better than others, but still.

Assuming I have quite a few controls with their own scripts (ASP.NET), I
would have you suggest to me which approach you recommend.

Paul
Jan 31 '06 #3

P: n/a

PJ6 wrote:
AJAX is great but I'd like to prevent users from clicking anything again and
causing more actions to happen while the server is working on the current
request without changing the contents of the page. I already set the pointer
to a wait cursor.

What's the best way to disable OnMouseDown document-wide?

Paul


Rather then trying to disable mouse actions, try disabling script
actions...

For example, set a Global variable when the request is sent to the
server

xmlhttp=new XMLHttpRequest()
xmlhttp.onreadystatechange=xmlhttpChange
xmlhttp.open("GET",url,true)
xmlhttp.send(null)

Processing = true; //now we know that we are waiting for a response

then in the stateChange function (the current request was completed)...

function xmlhttpChange() {
if (xmlhttp.readyState==4) {
if (xmlhttp.status==200) {
Processing = false;//now we know we've had a successful response
}
}

now before execution of any other function code, wrap a
function OtherPageAction() {
if (!Processing) {

//do other page actions like normal

} else {
UpdateSomeUserMessage("Processing... Please Wait");
}
}

This would obviously need to be tailored to your script, but I hope the
concept helps.

Jan 31 '06 #4

P: n/a
PJ6 wrote on 31 jan 2006 in comp.lang.javascript:
"Evertjan." <ex**************@interxnl.net> wrote in message
news:Xn********************@194.109.133.242...
What's the best way to disable OnMouseDown document-wide?


Polyurethane foam?

It is your page, so, fix your clientside script.


This is the very reason I hate JavaScript. In order to derive a global
behavior I have to change every last godforsaken element that uses
JavaScript. I acknoweldge that some ways are better than others, but
still.

Assuming I have quite a few controls with their own scripts (ASP.NET),
I would have you suggest to me which approach you recommend.


No, you would not, because this is a javascript NG and not a .net one.

Javascript cannot be blamed for what other technologies do with it.

Please instead hate .net technology. They have their own NGs.

Furthermore, onmousedown is not Javascript,
in IE vbscript works just as well:

==============
<script type='text/vbscript'></script>
<button onmousedown = "for i=0 to 10:confirm(i):next">
count</button>
==============

Would this vbs do any better?

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jan 31 '06 #5

P: n/a
PJ6 wrote:
"Evertjan." [...] wrote [...]
What's the best way to disable OnMouseDown document-wide?

Polyurethane foam?

It is your page, so, fix your clientside script.


This is the very reason I hate JavaScript. In order to derive a global
behavior I have to change every last godforsaken element that uses
JavaScript.


This does not have anything to do with the JavaScript programming language,
or any programming language for that matter. It is a Document Object Model
(DOM) issue.

<URL:http://www.w3.org/TR/DOM-Level-2-Events/events.html#Events-flow>
PointedEars
Jan 31 '06 #6

P: n/a
PJ6
Very useful, thank you.

Paul

"Thomas 'PointedEars' Lahn" <Po*********@web.de> wrote in message
news:19****************@PointedEars.de...
This does not have anything to do with the JavaScript programming
language,
or any programming language for that matter. It is a Document Object
Model
(DOM) issue.

<URL:http://www.w3.org/TR/DOM-Level-2-Events/events.html#Events-flow>

Feb 1 '06 #7

P: n/a
On 2006-01-31, PJ6 <no****@nowhere.net> wrote:
AJAX is great but I'd like to prevent users from clicking anything again and
causing more actions to happen while the server is working on the current
request without changing the contents of the page. I already set the pointer
to a wait cursor.

What's the best way to disable OnMouseDown document-wide?


make synchronous requests instead of async.

--

Bye.
Jasen
Feb 3 '06 #8

P: n/a
Jasen Betts wrote:
On 2006-01-31, PJ6 <no****@nowhere.net> wrote:
AJAX is great but I'd like to prevent users from clicking anything again and
causing more actions to happen while the server is working on the current
request without changing the contents of the page. I already set the pointer
to a wait cursor.

What's the best way to disable OnMouseDown document-wide?


make synchronous requests instead of async.

It's possible for a synchronous request to hang until the browser times
out - 20 seconds or so. During that time, the browser (FF, MSIE) are
completely unresponsive. I tried to use abort() with a timer but of
course abort() doesn't seem to get called while the request is pending.

So is there a way to limit the timeout or cut short the request? In my
case, if it takes more than about two seconds, something is broken and I
would want to stop the process and alert the user.

Richard
Feb 5 '06 #9

P: n/a
Richard Kramer wrote:
Jasen Betts wrote:
On 2006-01-31, PJ6 <no****@nowhere.net> wrote:
AJAX is great but I'd like to prevent users from clicking anything again
and causing more actions to happen while the server is working on the
current request without changing the contents of the page. I already set
the pointer to a wait cursor.

What's the best way to disable OnMouseDown document-wide? make synchronous requests instead of async.


It's possible for a synchronous request to hang until the browser times
out - 20 seconds or so. During that time, the browser (FF, MSIE) are
completely unresponsive.


Which is why asynchronous XMLHTTP requests are implemented.
I tried to use abort() with a timer but of course abort() doesn't
seem to get called while the request is pending.
Of course.
So is there a way to limit the timeout or cut short the request?


Of course, some browsers allows you to configure the timeout. Apart
from that, what you want is not possible with a synchronous XMLHTTP
request. You cannot have your cake and eat it too.

The problem in this discussion is that you want "to prevent users from
clicking anything again" which cannot be done without blocking the UA.
Would it be enough to prevent them from initiating a second XMLHTTP
request while the first one is happening?
PointedEars
Feb 6 '06 #10

This discussion thread is closed

Replies have been disabled for this discussion.