Wednesday, June 6, 2012

Disable Contextmenu On Right Click


function disableContextmenuOnRightClick(obj) {
                var rightclick;
                var e = window.event;
                if (e.which) {
                rightclick = (e.which == 3);
                }
                else if (e.button) {
                rightclick = (e.button == 2);
                }
                // true if right mouse button is clicked.
                if (rightclick) {
                // disable contextmenu
                obj.attachEvent ("oncontextmenu", function() {
                return false;
                });
                }
            }

Labels:

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home