Proto.Menu is a simple and lightweight prototype-based solution for context menu functionality on your page
<script type="text/javascript" src="js/prototype.js"></script> <script type="text/javascript" src="js/proto.menu.0.6.js"></script>
<link rel="stylesheet" href="proto.menu.0.6.css" type="text/css" media="screen" />
var myMenuItems = [ { name: 'Edit', className: 'edit', callback: function() { alert('Forward function called'); } },{ name: 'Copy', className: 'copy', callback: function() { alert('Copy function called'); } },{ name: 'Delete', disabled: true, className: 'delete' },{ separator: true },{ name: 'Save', className: 'save', callback: function() { alert('Saving...'); } } ]
<script type="text/javascript"> new Proto.Menu({ selector: '#contextArea', // context menu will be shown when element with id of "contextArea" is clicked className: 'menu desktop', // this is a class which will be attached to menu container (used for css styling) menuItems: myMenuItems // array of menu items }) </script>