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

No members online now.

Forum statistics

Threads
473,780
Messages
2,569,608
Members
45,241
Latest member
Lisa1997

Latest Threads

Top