1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2010
    Rep Power

    oncontextmenu window.event = null

    I am trying to create a custom right-click menu in javascript, and I can't get the coordinates of the mouse when using oncontextmenu in IE7. I have it working fine in firefox, but in IE the window.event comes back as null.

    checkbox.oncontextmenu = function(event) {
        if (event == null)
            event = window.event;
        alert("event: "+event);
        alert("window.event: "+window.event);
        /* Handle right-click */
    I understand that IE does not pass along the event, but is there any reason why both of my alerts (specifically window.event) print null?
    Last edited by jmac726; November 10th, 2010 at 10:10 AM. Reason: Fixed CODE tag

IMN logo majestic logo threadwatch logo seochat tools logo