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 programmers. 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 for me!!! Web Listbar
(Popularity: ) : This code will help you organize your support content (Links, news flash, Top 10). This mimics the common Listbars that you will find in other Desktop application languages like VB. Since it uses standard HTML as it's content, the sky ... 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 java menus etc etc... though the concept propably needs lots of refining... and the graphics are not exactly top notch ... Dropdown Menu
(Popularity: ) : By making just a few simple function calls, any website can have a full dropdown menu from which users can navigate. There can be any number of individual menus on a page, so there are few limitations. The type of ... Drop Down Menus DHTML
(Popularity: ) : Website Navigation / Menus: Cross browser, automatic positioning, large menus can be added with minimal change in the file size, comma separated arrays can be built easily via ASP/JSP/Perl/ect. Expandable TOC
(Popularity: ) : The Expandable Table of Contents is a script, which allows the creation of dynamic navigation systems. The user clicks on a root item, which then expands to reveal several new subtopics. This script is very simple to implement; requiring only ... DHTML_HMenu
(Popularity: ) : DHTML - Hierarchical Menu using JavaScript and object-oriented concept. 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 a few bugs Nice-looking Login Menu
(Popularity: ) : Hello. I'm a beginner in Java. I love programming but I'm into graphic design too. So, I love to see my program looking nice & smart =) I decided to made this login menu. It has 2 login options-admin & ...