Disable Mouse Events

S

SJ

Dear Friends,

I want to temporaraly disable events from my page. However, I cant seem
to get it to work. It will show my disables message, but then it goes
ahead and does the action I was trying to do (like clicking on a link).

Here is the code, any ideas?
-----
function disableEvents()
{
document.onclick = showDisabledMessage;
}
function enableEvents()
{
document.onclick = null;
}
function showDisabledMessage()
{
alert("Please wait for the current action to complete.");
return false;
}
 
R

RobG

SJ said:
Dear Friends,

I want to temporaraly disable events from my page. However, I cant seem
to get it to work. It will show my disables message, but then it goes
ahead and does the action I was trying to do (like clicking on a link).

Learn about javascript events, in paticular event order and bubbling.

<URL: http://www.quirksmode.org/js/introevents.html >


Your code only adds/removes a handler for the document object's click
event, it doesn't affect the triggering of any other DOM object's
event, or other events for the document object.
 

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,776
Messages
2,569,603
Members
45,196
Latest member
ScottChare

Latest Threads

Top