I would like to intercept all click events on my document.

Z

zoltix

Hi,

I am beginner in JavaScript. I would like to intercept all click
events on my document. I use this function for that
document.onmousedown=click;. It works well. But I would like to
continue the execution code on a other button or anything else.


Example
1) Click anywhere intercept click->Execute the code in function click().
2) Click on a link…. intercept click -> Execute the code in function
click() ->Load the link(http://test.html)
3) Click on a button… intercept click-> Execute the code in function
click() ->Execute the code for the button(submit, or other javascript)


Thank a lot for your help…



function click() {
if (event.button==1) {
alert(“Test event”)
//execute before….ex close all div
}
//Here continue code
}
 

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,764
Messages
2,569,567
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top