setContextMenu Method

             

Constructs a context menu that is displayed when a user right-clicks a DHTML scriptlet in the scriptlet container object.

Syntax

window.external.setContextMenu( menuDefinition )

Parameters

menuDefinition

Defines the command text and commands contained in the context menu. A one-dimensional array in which the menu items are defined using sequences of two elements, n and n+1.

Element n The command text. Shortcut keys are defined by preceding a letter with "&".
Element n+1 The method to be called when the command is chosen. You cannot pass parameters to the method.

Note   Context menus can only be defined in scripts written in VBScript or JavaScript, because only those languages can create arrays usable by the setContextMenu method.

Example

The following script defines a context menu with three commands:

<SCRIPT LANGUAGE="VBScript" FOR="Menu" EVENT="onclick">
   ' Define array
   dim menuItems(6)     ' 3 commands
   
   ' First menu item
   menuItems(0) = "Display the &time"     ' Command text
   menuItems(1) = "SetTime"

   ' Second menu item
   menuItems(2) = "Display the &date"     ' Command text
   menuItems(3) = "SetDate"

   ' Third menu item
   menuItems(4) = "Display the document t&itle"     ' Command text
   menuItems(5) = "SetTitle"

   ' Assigns the menu to the scriplet
   ' window.external.setContextMenu(menuItems)

</SCRIPT>