Question: Is there a way to detect if the javascript see if there was a click, and if there was, it can do something?

```
function clickin() {
    var mouseDown = 0;
    document.body.onmousedown = function() {
        ++mouseDown;
        var alle = document.getElementsByClassName('box');
        for (var i = 0; i < alle.length; i++) {
            value = "this.title='1'"
            alle[i].setAttribute("onmouseover", value);
        }
        document.body.onmouseup = function() {
            --mouseDown;
            var alle = document.getElementsByClassName('box');
            for (var i = 0; i < alle.length; i++) {
                value = "0"
                alle[i].setAttribute("onmouseover", value);
            }
        }
    }
}​

```

Answer: 
And the question is?  

You have already the code. 

Anyway, from my point of view, go for [jQuery](http://jquery.com/) and it's [mouse events](http://api.jquery.com/category/events/mouse-events/).
javascript can handle clicks, we use it for that. But it seems that you want to check if clicks are being handled on the document.

if you want to check that specifically at document level you can check if

```
document.onclick==null

```

and also checking mousedown/mouseup events on same way
because if you define a handler as you doing above you will destroy the previous if it exists

if you want to check on a more generic way you have to traverse the document and check for those events on every element.

however event handler can be bound latter and dynamically and checking all tree of a document repeatedly is not a good idea.

in that case (and also in the previous) you can audit the functions **addEventListener** and/or **attachEvent**

see function auditing here:
[How to implement a simple prioritized listener pattern in JavaScript](https://stackoverflow.com/questions/10839146/how-to-implement-a-simple-prioritized-listener-pattern-in-javascript/10839304#10839304)

and with that you can also audit the mouse events without destroying them.