Test the click event first. The following is the test code:
var addEvent = document.addEventListener ? function(el,type,fn){ el.addEventListener(type,fn,false);}:function(el,type,fn){ el.attachEvent("on"+type,function(){ fn.call(el,window.event); });}window.onload = function(){ addEvent(document,"click",function(e){ alert(e.button) });}window.onload = function(){ addEvent(document.body,"click",function(e){ alert(e.button) });}
|
Document Object |
Element Node |
Left |
Medium |
Right |
Left |
Medium |
Right |
IE8 |
○ |
○ |
× |
○ |
○ |
× |
Firefox 3.6 |
○ |
○ |
○ |
○ |
× |
× |
Google Chrome 8.0 |
○ |
○ |
× |
○ |
○ |
× |
Opera 11.0 |
○ |
× |
× |
○ |
× |
× |
Test Results
- In the Element Node Section, no difference exists between document. Body, Div, and input [type = button ].
- There is no difference in standard mode or weird mode in IE8.
- IE8 whether you use the input or button tag to generate a tag, the results are the same
- An error occurred while capturing the context menu. It is estimated that it was hijacked by the contextmenu event.
To fully capture the left middle right click, it is estimated that only formal mouse events, such as mousedown, can be used.
|
Document Object |
Element Node |
Left |
Medium |
Right |
Left |
Medium |
Right |
IE8 |
○ |
○ |
○ |
○ |
○ |
○ |
Firefox 3.6 |
○ |
○ |
○ |
○ |
○ |
○ |
Google Chrome 8.0 |
○ |
○ |
○ |
○ |
○ |
○ |
Opera 11.0 |
○ |
○ |
○ |
○ |
○ |
○ |