469,358 Members | 1,639 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,358 developers. It's quick & easy.

how to turn off onclick

Hi

I have couple elements with on click events which trigger the ajax to as
the server for informations. I'd like to be able to turn off all onclick
events at once and then turn them on when the response form the server
arrives.

Is it possible?

--

Ralph
Dec 6 '06 #1
2 1858

Ralph wrote:
Hi

I have couple elements with on click events which trigger the ajax to as
the server for informations. I'd like to be able to turn off all onclick
events at once and then turn them on when the response form the server
arrives.

Is it possible?
Use Matt Kruse's AjaxToolbox library. Before sending a request, use
the 'isActive' method to determine if a previous request hasn't
finished yet. If isActive returns true, do your 'request is active'
logic. Otherwise, send a new request.

<URL: http://www.ajaxtoolbox.com/request/>

Another option is to mess with the onclick handlers themselves (e.g.
remove or modify them when the request is made, replace them when the
call returns), that is unlikely to be as good as the above.
--
Rob

Dec 6 '06 #2
Ralph wrote:
Hi

I have couple elements with on click events which trigger the ajax to as
the server for informations. I'd like to be able to turn off all onclick
events at once and then turn them on when the response form the server
arrives.

Is it possible?
// disable all mouseclicks
document.onclick = function { return false };

// enable all mouseclicks
document.onclick = null;

That should work for you in all the modern browsers.

---------------------------------------------------------------------------
http://www.hunlock.com -- Permanently under construction (And proud of it!)
$FA
Dec 6 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.

By using this site, you agree to our Privacy Policy and Terms of Use.