This is a JavaScript library, which allows the web developer to easily add a context menu to his website. It provides an easy way for the user to navigate the site, and also prevents the user from accessing the default context menu.
Adding The Menu Framework:
Before the menu is constructed, a framework must be established, so the menu library has some objects to work with. First, a style sheet should be defined. It should be a class called #ContextMenu. Also, a hover event handler must be set up, so the context menu will appear more user friendly. This is done by simply creating a JavaScript function called Highlight(Object). Object will be the object on the page that has the cursor hovering over it. Included, is a generic function, which can be altered accordingly. Also, an initialization function must be called when the document is loaded, to set up specific variables for the menu library. It is called on the document onload event. The parameters, which it accepts, are: Width and Font Height. The width will be the number of pixels wide the menu should be. The font height is the number of pixels, vertically, that each line of text will take up. Also, two event handlers must be installed: document oncontextmenu must be assigned to ToggleContext() and document onmousemove must be assigned to TestOnMenu(). Finally, the object framework must be set up. Simply enclosing the entire menu within a DIV tag does this. The tag must have the ID of ContextMenu.
Adding Menu Items:
Adding menu items is very easy to accomplish. Simply call the AddContext function. The parameters accepted by this are: Name, Address, Color, Title. The Name parameter is the label, which will appear on the document. Address is the URL of the document to be linked to. Color is the default color of the item, and Title is an optional parameter, which specifies the title attribute of the item. Horizontal rules can also be easily placed in the context menu. Simply place a single ‘-‘ as the Name parameter and a horizontal rule will be placed within the menu. The color attribute will be used in this situation, but none of the other parameters
File List:
condemo.htm
1Kb
context.doc
28Kb
context.js
2Kb
Similar code
Right Click Menu (Multi-level Context Menu)
(Popularity: ) : VSContextMenu 1.0 Allows you to create multi-level context menu and populate it right on your web pages. Designed for web ... A different kind of menu system
(Popularity: ) : This is an example to my way of creating a different kind of menu than the ordinary dropdown menus or ... Handy XP Style Menu
(Popularity: ) : This is a pretty menu in XP Style. Easy to setup, higly customizable. If you find it useful, please rate ... Web Listbar
(Popularity: ) : This code will help you organize your support content (Links, news flash, Top 10). This mimics the common Listbars that ... Dropdown Menu
(Popularity: ) : By making just a few simple function calls, any website can have a full dropdown menu from which users can ... Drop Down Menus DHTML
(Popularity: ) : Website Navigation / Menus: Cross browser, automatic positioning, large menus can be added with minimal change in the file size, ... Expandable TOC
(Popularity: ) : The Expandable Table of Contents is a script, which allows the creation of dynamic navigation systems. The user clicks on ... DBL click to fade in very nice
(Popularity: ) : DBL click to fade in very nice - When you double click the screen a menu fades in very nice ... DHTML_HMenu
(Popularity: ) : DHTML - Hierarchical Menu using JavaScript and object-oriented concept.