Mega Code Archive

 
Categories / JavaScript DHTML / GUI Components
 

Popup Menu

<html> <!--   Distributed as part of 'AT JsMenu' under the same terms (LGPL)   Author: AT Mulyana (atmulyana@yahoo.com)   Copyright (C) 2001-2006 AT Mulyana --> <head>   <title>Popup Menu</title> <link href='AtJsMenu-classic.css' rel='stylesheet' type='text/css' /> <link href='popup-menu.css' rel='stylesheet' type='text/css' /> <script language='JavaScript' type='text/javascript' src='signs.js'></script> <script language='JavaScript' type='text/javascript' src='browser.js'></script> <script language='JavaScript' type='text/javascript' src='AtJsMenuKeys.js'></script> <script language='JavaScript' type='text/javascript'><!-- if (navigator.family) {   document.writeln("<"+"script language='JavaScript' type='text/javascript' src='compat-"+navigator.family+".js'"+"><"+"/script"+">"); } //--> </script> <script language='JavaScript' type='text/javascript' src='AtJsMenu.js'></script> </head> <body> <script language='JavaScript' type='text/javascript' src='menu.js'></script> <script language='JavaScript' type='text/javascript'><!-- var g_oPopup = new AtJsMenuPopup(); oMenu = new AtJsMenu('Sub Menu 1 xxxxx'); oMenu.add(new AtJsMenuItem('Child Sub Menu 1')); oMenu.add(new AtJsMenuItem('Child Sub Menu 2')); oMenu.add(new AtJsMenuItem('Child Sub Menu 3')); g_oPopup.add(oMenu); oMenu = new AtJsMenu('Sub Menu 2 yyyyy'); g_oPopup.add(oMenu); oMenu.addSeparator(); oMenu.add(new AtJsMenuItem('Child Sub Menu 4')); oMenu.add(new AtJsMenu('Child Sub Menu 5')); oMenu = oMenu.getItem(2); oMenu.add(new AtJsMenuCheckBoxItem('A CheckBox Menu Item 1')); oMenu.add(new AtJsMenuCheckBoxItem('A CheckBox Menu Item 2')); oMenu.addSeparator(); g_oPopup.addSeparator(); g_oPopup.add(new AtJsMenuItem('Menu Item zzzzz')); g_oPopup.addSeparator(); g_oPopup.insertSeparator(0); //--> </script> <script language='JavaScript' type='text/javascript' src='popup-menu.js'></script> <!--   <select style="position:relative">     <option>Satu</option>     <option>Dua</option>     <option>Tiga</option>   </select> --> <p style="margin:10px"><textarea id="txtTest" cols='100' rows='5'>Give focus this textbox and then select a menu. How's the effect? Something wrong?</textarea></p> <p style="margin:10px"> Right click anywhere on this page. It will bring up the context menu. The context menu does nothing. You should only watch its behavior. Beside right clicking, the popup-key (on win keyboard) can also be used. On Opera 7.5+, use ']' (right square bracket).<br /> When right clicking is used, opera still shows its own context menu. If you use popup-key (or ']' on Opera 7.5+), you can see the other directions to which the popup is slidden when the popup comes up. These directions are new in version 1.2. Try these combinations keys and you will see these directions: <ul>   <li>Popup-key: 'south-east'</li>   <li>Ctrl+Popup-key: 'south-west'</li>   <li>Shift+Popup-key: 'north-west'</li>   <li>Ctrl+Shift+Popup-key: 'north-east'</li> </ul> <h3>View source to see the code!!</h3> </body> </html>                          AtJsMenu20060627.zip( 161 k)