JavaScript Menu, DHTML Menu Powered By Milonic
Demo - New Item Image Function
for use with Milonic Solutions' DHTML Menu V5
This sample page was created in reference to this thread of discussion in the "Help and Support for Version 5".

The mm_timedNew() function allows the placement of a 'new' image to denote something new on a site.

To use the mm_timedNew() function:

  1. Place the following code at the top of your menu_data.js file
    
    function checkNew(date) 
    { 
      var appendToItem = ""; 
      expdate = new Date(date); 
      curdate = new Date(); 
      if (expdate.getTime() > curdate.getTime()) { 
        appendToItem = "image=thePath/new.gif;imagealign=left;imagealt=new item!;"; 
      } 
      return appendToItem; 
    } 
    
    
  2. change thePath to the path for your image and the new.gif to the name of your image

  3.  
  4. You can add any of the 'image' modifying menu item properties in the last part of the assignment to appendToItem; e.g., imageheight, imagewidth, imageposition, etc.

  5.  
  6. If you want to assign a different position to a top level image and a submenu image, you will need to copy the function, paste it at the top of the menu_data.js file and add a 1. If you want to do this, please read the note below.

  7.  
  8. Add    + checkNew('1/05/2006')    as the last item in the aI string using your own date, of course.  e.g.,
    aI("text=Item Text;url=whatever.htm;" + checkNew('1/05/2004'));

  9.  
  10. If the expiration date has been reached, checkNew() does not return any information for the menu item and doesn't display the image.
  • NOTE:  doing this through client-side scripting will increase the amount of time it takes to build the menu, for each page that the user visits. The increase may become noticable if you have a lot of items that use this function. Each time the function is called, it adds more time to building the menu, even if the item is expired (because the function is still called). So, it would be prudent to go through your menu code now and then and get rid of the function call for long-expired items. Keep this in mind if you decide to create more functions in order to change image position on various menus.
  • DHTML Menu courtesy of Milonic Solutions
    Download  mm_timedNew() sample