Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Nov 2010
    Thanked 0 Times in 0 Posts

    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?

  2. #2
    Master Coder Dormilich's Avatar
    Join Date
    Jan 2010
    Behind the Wall
    Thanked 568 Times in 561 Posts
    calling your variable event could be troublesome, because event == window.event
    The computer is always right. The computer is always right. The computer is always right. Take it from someone who has programmed for over ten years: not once has the computational mechanism of the machine malfunctioned.
    André Behrens, NY Times Software Developer


Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts