Page view counter

How do I make menus appear when right mouse button has been clicked above a button?

Last post 12-30-2005 12:52 AM by Michael_D. 2 replies.

Sort Posts:

  • How do I make menus appear when right mouse button has been clicked above a button?

    12-05-2005, 7:29 AM
    • Loading...
    • Michael_D
    • Joined on 11-05-2005, 3:28 PM
    • Posts 14
    • Points 70
    How do I make menus appear when right mouse button has been clicked above a button and then execute the user selected choice?
  • Re: How do I make menus appear when right mouse button has been clicked above a button?

    12-05-2005, 10:33 AM
    • Loading...
    • NicButler
    • Joined on 12-12-2002, 5:14 AM
    • London, England
    • Posts 384
    • Points 1,885

    Try something like this:

    <html>
    <head>

    <script>
    function showMenu()
    {
     document.getElementById('menu').style.display='block';
    }

    function hideMenu()
    {
     document.getElementById('menu').style.display='none';
    }


    </script>

    </head>

    <body onClick="hideMenu();">
    <a href="#" oncontextmenu="javascript:showMenu();return false;">Right Click here for menu</a><br>
    <div id="menu" style="display:none;background-color:pink; border : 1px solid black; width:300px">
       <a href="javascript:hideMenu();alert('menu1 clicked');">Menu item 1</a><br>
       <a href="javascript:hideMenu();alert('menu2 clicked');">Menu item 2</a><br>
       <a href="javascript:hideMenu();alert('menu3 clicked');">Menu item 3</a><br>
       <a href="javascript:hideMenu();alert('menu4 clicked');">Menu item 4</a>
    </div>
    </body>
    </html>

  • Re: How do I make menus appear when right mouse button has been clicked above a button?

    12-30-2005, 12:52 AM
    • Loading...
    • Michael_D
    • Joined on 11-05-2005, 3:28 PM
    • Posts 14
    • Points 70

    Thank you.

    I want to use a graphic image instead of the text "Right Click here for menu".  I also want to execute the selected option.  I don't see where the variable where the menu choice has been saved.  I will check to see if there is anything in a variable called "oncontextmenu".

    With VS 2005 Express Edition I could use the contextmenu tool (that was perfect), but in Visual Web Developer I cannot find it and do not know how to create it.  The only option I can find is the drop down and fly out menus in the navigation section.

    Unfortunately, I have entered this code set a break point and I try to start debugging.

    Nothing happens ... that has never happened before it would always says running IIS server on Port # and everything worked fine.

    Now nothing.

    I think I have a new and different problem.

    I will try setting different options now although I did not before and if nothing else works I will back the entire current development project remove and try to reinstall everything.  I can only hope that something works.

    Any help on this contextmenu issue and being able to open a window at x and y with a simple blue menu bar and minimize and maximize and close. A gentleman called Bilal said he would email me a control for this to mdyrnaes@hotmail.com, but so far I have gotten nothing.

    This would be amazing .

    Thanks.

    Michael

Page 1 of 1 (3 items)