Languages Java Menus  

JavaScript Context Menu Library

download download  
important code information
author:
Nicholas Skapura
minimum requirements:
JavaScript Context Menu Library description

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.htm1Kb
context.doc28Kb
context.js2Kb

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.
User reviews

Write a review:
1 2 3 4 5 6 7 8 9 10
1=poor 10=excellent
Write review*
Your name*
Email*
  (Comments are moderated, and will not appear on this site until the editor has approved them)
 
Rate me
supported os
stats
downloads 365
version
size in Kb 6
popularity   2587/5827732
user rating 4/10
ad


New Code
Popular Code