Popup Menu : Menu 2 « GUI Components « JavaScript DHTML






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)

Related examples in the same category

1.AtJsMenu Demo
2.Example 1: Basic Menu From Existing Markup
3.Example 2: Basic Menu From Pure JavaScript
4.Example 3: Grouped MenuItem Instances From Existing Markup
5.Example 4: Grouped MenuItem Instances Using Pure JavaScript
6.Example 5: Grouped MenuItem Instances With Titles From Existing Markup
7.Example 6: Grouped MenuItem Instances With Titles Using Pure JavaScript
8.Example 7: Multi-tiered Menu From Existing Markup
9.Example 8: Multi-tiered Menu From Pure JavaScript
10.Example 9: Handling Click Events
11.Example 10: Listening For DOM-Related Events
12.Example 11: MenuItem Configuration Properties
13.Example 12: Setting Configuration Properties At Runtime
14.Example 13: Multi-tiered Menu with Progressive Rendering of Submenus
15.Website Left Nav Example (with submenus built from JavaScript) 1
16.Website Left Nav Example (with submenus built from markup) 2
17.OS-Style Programs Menu Example
18.Website Top Nav (with submenus built from JavaScript) 3
19.Website Top Nav (with submenus built from markup) 4
20.Drop down menu and sub menu
21.Vertical menu and image menu
22.Emulate XP start menu
23.xmenu-xlayer-3
24.tree-menu
25.menu for applications