mapbdhtml::mapb_menu documentation::2
 mapbMenu Version 0.9 documentation (1/2)
 

Options of the elements of the menu

The call to the menu can be maintained with nameofmenu.addItem (Text, URL, isLast), but now it can be extended replacing URL by an associative Array, which must contain the entrance url obligatorily, and that can have the following options:

{'url':'aurl.html or option: a,v,x,-', 'target':'atarget', 'background':'acolor', 'backgroundA:'otherColororImg', 'txtcolor':'acolor', 'txtacolor':'yetanotherColor', 'width': number, 'height':number, 'winOptions':'options', 'onclick':'anAction', 'nextopenDir':'right or left','onmouseover':'an action','onmouseout':'an action','image':'url(animage.gif)','imageA':'url(anotherimage.gif)' }

The first entrance works just as URL in the previous versions. The option 'target' indicates the target of the link. The options 'background', 'backgroundA', 'txtcolor', 'txtacolor' redefine the general preferences of the menu. 'theWidth' serves to modify the width of the menu, it can't be used only for a single element, so, if it is used, it must become in all the elements of the corresponding submenu. 'theHeight' can be used to change the height of any element. If we defined a target that is called ' blanc', or any name that we want, is created a new window whose aspect can be controlled with 'winOptions', for example with 'width=200, height=200,status=no, toolbar=no, resizable=no, location=no, scrollbars=no' we created a window like the one of the example that there is in the menu of this page.If we define 'url':'a' we can write on 'onclick' a custom action, like 'onclick':'alert (\'Hello world!\')'. The direction of the next submenu can be changed with 'nextopenDir':'right' or 'nextopenDir':'left' defined in the items with 'url':''. Since 0.8.7 update we can define a onmouseover or onmouseout , like 'onclick' actions.

Menu with relative position New in 0.9

This is a example of a relative positioned menu:

To define a menu to be relative you must put the definition of the menu into a layer named with the name of the menu adding _ref, and declare the variable positioning to relative internalMenu.positioning = 'relative'; like in this example:

<div id="internalMenu_ref" name="internalMenu_ref">
<script language="JavaScript1.2" type="text/javascript">
internalMenu = new Menu ('internalMenu',0,0);

internalMenu.positioning = 'relative';
internalMenu.sm_width = 125;
internalMenu.m_vertical = false;
internalMenu.m_color = '#3333AA';

internalMenu.addItem ('Idioma/Language','',true);
internalMenu.addItem ('English',{'url':'v','background':'#FFFF66'},false);
internalMenu.addItem ('Catal&agrave;',{'url':'ca/menu2.html','background':'#FFFF99'},false);
internalMenu.addItem ('Castellano',{'url':'es/menu2.html','background':'#FFFFCC'},true);
internalMenu.doMenu();
</script>
</div>

Relative menus don't work in menus defined to work in multiple frames and the initial position must be 0,0.

Menu in different frames

In the head of the document that defines the frameset we wrote:

<script language="JavaScript1.2" src="mapb_menu.js"></script>
<script language="JavaScript1.2" src="mapb_menuframes_def.js"></script>


Where 'mapb_menuframes_def.js' is the name of the definition of the menu. The menu is defined just as the version without frames with the reservation that does not have to contain the final call to doMenu (), nor the code that controls the pulsation of the mouse. It must add the following preferences, with the respective names of frames where the initial menu goes and in which are the submenus:

mainMenu.frameMenu = 'menuframe';
mainMenu.frameSubMenu = 'submenuframe';


In both documents that contain the menu we must put the following code after the definition body of the page:

<script type="text/javascript" language="Javascript">
<!--
parent.mainMenu.doMenu(window.name);
if (document.layers){
    document.onMouseDown = parent.hideMenus;
} else {
    document.onclick = top.hideMenus;
}
// -->
</script>


It is important to remember that pages that do not contain the call to doMenu () cannot be shown in frame where appear submenus, as they can be external pages. In such case the menu would not activate and an error occur. If it is necessary, to open pages that do not have this call, use the option 'target':'_blank' or 'target':'_top'.

You are here configuration

With this feature the user can understand in a visual way where he is in the site structure. When rollover on the icon the menu shows the submenus until the one that refers to the current page. To activate this put after the call to doMenu () this code:

menuName.youAreHere (name,left,top,width,height,text,color);

for example:

mainMenu.youAreHere ('yah',5,190,110,25,'You are here','#FFFFCC');

 

mapbMenu Version 0.9 documentation (1/2)

download (70 kb)

Part of mapbDhtml website, maintained by Miquel Angel Pintanel. Last update:  09/02/2003 . Url: http://perso.wanadoo.es/mapintanel/mapbdhtml/menu2.html e-mail: mapbdhtml@wanadoo.es