how to turn off onclick

R

Ralph

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?
 
R

RobG

Ralph said:
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.
 
P

pcx99

Ralph said:
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,818
Latest member
Brigette36

Latest Threads

Top