Milonic Home Page Information and Benefits of Milonic Products Some Samples of DHTML and JavaScript Products Download DHTML Menu Purchase Milonic JavaScript DHTML Products Tech Support Contact Milonic
Member Login - Search: Sitemap
Current Menu Version: 5.953 dated Monday March 14 2016 Click to Download

JavaScript Menu Methods - Quick Reference Guide

Here is a list of methods you can use for modifying and manipulating your menus.

You will need some knowledge of programming to be able to get the most out of these functions but it's also a good place to start learning JavaScript and DHTML.

The following methods are built into the standard menu code by default

Object_Ref gmobj ( string Object_ID )

gmobj() returns an object reference to ANY HTML object. This method is used by the menu system to return a reference to a menu.

Valid syntax is menuObject = gmobj("menu1");

array gpos ( Object_Ref )

gpos returns the dimensions and position of a menu. Data is returned in an Array with the elements as follows:
  • array_element[0] = Top
  • array_element[1] = Left
  • array_element[2] = Height
  • array_element[3] = Width
Valid syntax is var menuPosition = gpos( gmobj("menu1") ); the variable menuPosition will become an array of menu positioning and dimensions.

spos( Object_Ref, [integer top], [integer left], [integer height], [integer width] )

spos Sets the position and dimensions of an HTML object. You must retrieve a reference to a HTML Object or Menu in order to pass this information.

All position/dimension values are in pixels

syntax is spos ( Object reference, top position, left position, height, width )

Entering null will keep the current value, for example spos(gmobj("menuname"),null,null,null,200) will set the width to 200 pixels but leave the other values as they are.

null is also, the default value so spos(gmobj("menuname"),200) will set the top position of the menu to 200 but leave the other values as they were.

menuDisplay ( Object_Ref , bool _show )

menuDisplay displays a menu. You need to have a reference to a menu or other HTML object and show/hide is boolean value:
Syntax is menuDisplay(gmobj("menuname"),1) to show and menuDisplay(gmobj("menuname"),0) to hide.

closeAllMenus ()

closeAllMenus will hide ALL menus, even if they are visible but moved out of view. This command is used to clear the screen of unwanted menus.

integer getMenuByName ( string Menu_Name )

getMenuByName will retrieve a menu number by a given menu name.

Syntax is menuNumber = getMenuByName("main menu");
If "main menu" is the first menu in the data file, this will be represented as 0. This method is not case sensitive.

integer getMenuByItem ( integer Item_Reference )

getMenuByItem retrieves the menu number containing the item queried on

integer getParentMenuByItem ( integer Item_Reference )

getParentMenuByItem retrieves the parent menu by declaring a menu item reference

integer getParentItemByItem ( integer Item_Reference )

getParentItemByItem retrieves the parent menuitem by declaring a menu item

itemOn ( integer Item_Reference )

itemOn triggers the declared menu item as though the user had moved their mouse over the menu item with onMouseOver.

itemOff ( integer Item_Reference )

itemOff triggers the declared menu item as though the user had moved their mouse off the menu item with onMouseOut.

popup ( string Menu_Name, [position 1=Mouse Coords or imageName by image location], [integer Top_Offset], [integer Left_Offset], [Boolean Disable_Collision_Detection], [Integer Open_Menu_Delay] )

popup displays a sub menu by name in several locations. If just the menu name is declared as in popup("menuname"); this will display the menu at the top and left positions specified in the data file. If a 1 is specified as the second parameter the sub menu appears at the mouseX and mouseY coordinates.

If the menu needs to be positioned in relating to an image, you can add this image name as the second parameter. like this popup("menuname","imagename");

Top and Left offsets are permitted to fine tune the positioning. These are entered as pixel values to the 3rd and 4th parameters, like this: popup("menuname","imagename",10,-10); this will place the sub menu at the images left bottom corner but adjust its top position down 10 [10] pixels and shift it to the left by 10 [-10] pixels
In order to add a delay to opening popup Menus, you need to specify this delay (in milliseconds) to the 6th Parameter. An example is popup('menuname',null,null,null,null,500)

popdown ()

popdown is very similar to closeAllMenus but it has additional code for handling popup menus.

Purchase The Menu

Download DHTML Menu

See our list of Menu users

Milonic provide full featured pull down web menus for some of the worlds largest companies

Learn about how Milonic's DHTML menus can benefit your site

What does it cost? DHTML Menu prices

Who is using us?
Sample Client list

Bespoke menu design and build service from the Milonic team

Our bolt-on modules provide free optional extras for specialist projects

Free icons and images for all licensed users with our Menu Imagepack

What is Milonic up to at the moment? Check our blog