js the right mouse button click event

https://www.cnblogs.com/sea-stream/p/9638870.html

 

= the window.onload function () {
            // remove the default contextmenu event, otherwise it will appear at the same time and the right events. 
           = document.oncontextmenu function (E) { 
               e.preventDefault (); 
           }; 
           document.getElementById ( " Test " ) .onmousedown = function (E) {
                IF (e.button == 2 ) { 
                   Alert ( " you right point " ); 
               } the else  IF (e.button == 0 ) { 
                   Alert ( " you left point " ); 
               }the else  IF (e.button == . 1 ) { 
                   Alert ( " you point roller " ); 
               } 
           } 
}

 

Guess you like

Origin www.cnblogs.com/150536FBB/p/11544314.html