Middle mousclick with javascript ( no jQuery )
<p>I was using <a href="http://stackoverflow.com/a/1803868/1488915">this</a> solution to hide divs on middle mousclick, but now I need to include it inside a plain debug script where no jQuery is available ( and never will ).</p>

<p>How can I write that event and bind with plain javascript?</p>

<p>I was searching google and SO, but only working scripts I got, where all jQuery based.</p>

<hr>

<p>Final code:</p>

<pre><code>&lt;script type="text/javascript"&gt;
    function hideOnMiddle(event) {
        if ('which' in event) {
            if( event.which == 2 ) {
                document.getElementById('test').style.display = 'none'; 
            }
        }
    }
&lt;/script&gt;
&lt;div id="test" onmousedown="hideOnMiddle(event);"&gt;Hide me with middle mouse button&lt;/div&gt;
</code></pre>
