VMaxPopup

Right click anywhere on the page to see it in action
  • Replace browser context menu with custom hierarhical menu
  • Unlike DHTML solutions, this one does not have problems with form elements. Select element below, placed here for testing purpouses, so you may test how select and VMaxPopup overlaps. Compare this with DHTML solutions, and you will understand the advantages.
    Right click on this select to test popup menu overlapping

    Installation

    1. Download package, unpack it, and upload vmaxpopup.class file to your server.
    2. Open your HTML in any TEXT editor, like Notepad.exe
    3. Find opening <HEAD> tag and insert the following code right next to it.
    <style>
     .corner{position:absolute;top:0;left:0;}
    </style>
    <script>
     function onMenuLoad(){
       var appl = document.applets["popupapplet"];
       appl.addItem(null,'item1','Label 1','alert("item 1 pressed ")');
       appl.addItem(null,'item2','Label 2','alert("item 2 pressed ")');
       appl.addItem(null,'item3','Label 3','alert("item 3 pressed ")');  
       appl.addSeparator(null);
       appl.addSubMenu(null,'sub1','Sub Menu');
         appl.addItem('sub1','sub1_1','Item 1 - 1 ','alert("item 1-1 pressed ")');
         appl.addItem('sub1','sub1_2','Item 1 - 2 ','alert("item 1-2 pressed ")');
         appl.addItem('sub1','sub1_3','Item 1 - 3 ','alert("item 1-3 pressed ")');
       appl.addSeparator(null);
       appl.addItem(null,'item4','Label 4','alert("item 4 pressed ")');
     }
    
    </script>
    <APPLET name="popupapplet" CODE=vmaxpopup.class 
        WIDTH=0 HEIGHT=0 class="corner"  MAYSCRIPT>
    <param name="ONLOAD" value="onMenuLoad()">
    <param name="KEY"    value="Free Version">
    <param name="AUTHOR" value="Virtual_Max (http://come.to/vmax)">
    </APPLET>
    
    4. Find <BODY ... > tag in your HTML and insert the following handler inside
    <BODY ... onLoad="if(document.all) document.body.oncontextmenu=new Function('return false;')" >
    
    5. Customize menu structure...
    <param name="ONLOAD" value="onMenuLoad()"> This parameter informs the applet to call JavaScript function onMenuLoad() when applet is loaded and ready to operate. Inside this function you can populate menu with the help of 3 public applet methods
    appl.addItem(parentName,Name,menuTextLabel,javascriptExpression); 
    
    This method allows one to add child to menu or any submenu by name. Names must be unique string handles for each menu item in hierarchy. addItem(..) method creates new menu item with given "Name" and add it to parent submenu with name "parentName", MenuTextLabel is text you will see on this menu item and JavascriptExpression is expression written in JavaScript to evaluate when this menu item clicked. To add childs to root one can use parentName as "_root" or just pass null. Note, that if due to your mistakes parent with specified name is not found, child will be added to root menu.
    
    appl.addSubMenu(parentName,Name,SubMenuTextLabel); 
    
    addSubMenu(..) is similar to addItem, but add submenu entry. It doesn't have jsExpression as on click it opens submenu.
    
    appl.addSeparator(parentName);  
    
    add separator line into menu.

    Using these 3 simple methods you can customize menu as you need..

    6. [Optional] Register. You may use this menu absolutely free and it will present a popup window with a link to my site. If you want to get rid of this link you must register this applet

    7. This applet is targeted for serious web content developers. Before bothering me with questions, please be sure you know what HTML is, what are HEAD and BODY tags, what are java applets and what is the difference between Javascript and Java.
    Don't know? Please check this site for documentation
    developer.netscape.com
    java.sun.com
    and nice JavaScript tutorial written by Stefan Koch
    Stefan's Home

    ©2001 Virtual_Max (http://come.to/vmax)

    Last-Modified: Feb 28, 2001