JavaScript Menu, DHTML Menu Powered By Milonic

Demo for  Swap Text Function
for use with Milonic Solutions' DHTML Menu V5
This sample page was created in reference to this thread in the "Help and Support for Version 5".

Mouse over the above menu to see the change.

Swap Text takes two global variables and two small functions.

  1. mm_onText() takes one parameter, rollOnText, which is the text that you want to substitiue into the menu item in the onmouseover state. Call mm_onText() from the menu item's onfunction property.


  2. mm_offText() takes no parameters and should automatically restore the "rolled" item's original text onmouseout. Call mm_offText() from the menu item's offfunction property.


  3. The function can be applied in as many items as wanted.


  4. Unless you match the two different texts as to length, you will need to specify an item width. If you don't fix the item's width to accomodate the wider of "on text" and "off text", then the item will fluctuate in size for mouseOn and mouseOut states and make the menu look as if it is shifting. If you specify a width, using align=center in the item will keep it looking uniform on mouseOver / mouseOut
In the example provided here, the first item has been 'matched' as to length, and no item width is specified, item two has no itemwidth specified and it 'shifts' the menu, and Item 3 has itemwidth specified to accommodate the wider text.

To implement Swap Text:

  1. Place the following code at the top of the menu_data.js file
    var mm_rollOffText; 
    var mm_rollItem; 
    
    function mm_onText(rollOnText) 
    { 
      mm_rollItem = _itemRef; 
      mm_rollOffText = _mi[mm_rollItem][1]; 
      _mi[mm_rollItem][1] = rollOnText; 
      BDMenu(_mi[mm_rollItem][0]); 
      itemOn(mm_rollItem); 
    } 
    
    function mm_offText() 
    { 
      _mi[mm_rollItem][1] = mm_rollOffText; 
      BDMenu(_mi[mm_rollItem][0]); 
      itemOff(mm_rollItem); 
    } 
  2. Call the function in the aI string. [no line breaks]
    aI("text=Point at me;url=whatever.htm;
    onfunction=mm_onText('Now click me');offfunction=mm_offText();");
DHTML Menu courtesy of Milonic Solutions
Download  mm_swapText() sample