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 Solutions
Member Login - Search: Sitemap
Current Menu Version: 5.909 dated Thursday November 17 2011 Click to Download
Featured at:
more
hide
ldscatalog.com
LDS Online Store - Welcome!
US-CAN Sales Catalog
Google Translate
Google's free online language translation service instantly translates text and web pages. This translator supports: English, Afrikaans, Albanian, Arabic, Armenian, Azerbaijani, Basque, Belarusian, Bengali, Bulgarian, Catalan, Chinese, Croatian, Czech, Danish, Dutch, Estonian, Filipino, Finnish, French, Galician, Georgian, German, Greek, Gujarati, Haitian Creole, Hebrew, Hindi, Hungarian, Icelandic, Indonesian, Irish, Italian, Japanese, Kannada, Korean, Latin, Latvian, Lithuanian, Macedonian, Malay, Maltese, Norwegian, Persian, Polish, Portuguese, Romanian, Russian, Serbian, Slovak, Slovenian, Spanish, Swahili, Swedish, Tamil, Telugu, Thai, Turkish, Ukrainian, Urdu, Vietnamese, Welsh, Yiddish
more
hide
my.opera.com
My Opera - Blogs and photos
On My Opera you can share photos, start your own blog, meet friends and do mobile blogging. You can also download skins for the Opera browser.
more
hide
avweb.com
AVweb » The World's Premier Independent Aviation News Resource
<p>
more
hide
villanova.edu
Villanova University: Home
more
hide
umich.edu
University of Michigan
University of Michigan is one of the top universities of the world, a diverse public institution of higher learning, fostering excellence in research. U-M provides outstanding undergraduate, graduate and professional education, serving the local, regional, national and international communities.
more
hide
bu.edu
Boston University
Boston University is a leading private research institution with two primary campuses in the heart of Boston and programs around the world.
more
hide
naseeb.com
Welcome to Naseeb - The largest Muslim social network and matchmaking website
Naseeb is the world's most powerful Muslim social networking and matchmaking website. The website is committed to bringing together single Muslim men and single Muslim women and providing a platform for them to interact and find the right Muslim matrimonial matches for themselves.
more
hide
spainexchange.com
Why Study Abroad - Study Abroad Programs & Scholarships - International Exchange
Why Study Abroad: SpainExchange.com is an online directory of universities, graduate programs, US study abroad programs, language schools, vocational schools, and international primary and secondary schools abroad.
more
hide
religionfacts.com
Religion, World Religions, Comparative Religion - Just the facts on the world's religions.
Religion facts, objective guide to world religions, comparative religion charts. Start your research on world religions here.

How To Have Multiple DHTML JavaScript Menus On The Same Page

This document demonstrates the Milonic DHTML Menu's capability when more than one menu is required on a single web page.

The principle behind adding multiple menus is based around the location of the drawMenus command within your menu_data.js and within your .HTML document.

The drawMenus command is used to actually render the menu to the webpage, this process is final and can only be used once for each set of menus. However, there are no limits to the number of times the drawMenus command can be executed provided menus have been declared between each drawMenus execution.

Don't worry, the above may seem a little complicated but you'll get the idea once you've seen a few examples.

Basically, the principle is to declare some menus, then render them to the web page using the drawMenus command, and then declare some more menus and then render them too and so on.

Unfortunately, there are pit falls when declaring sub menus inside table cells though so you'll need to be prepared for that. When using menus built inside table cells it's extremely important to build your sub menus away from the table cell, usually at the very top of the document just after the <BODY> tag. You must only build the main menu inside the table cell. We'll explain later how to do this and there is also a document on table based menus here: http://www.milonic.com/tablemenu.php

Multiple Menus Example

The best way to learn about the technique for building multiple menus is by example so here is perhaps the simplest multiple menus we can show you. The principle is the same accross all menus no matter how large. All you need to do is just expand on the menus you see here.


The code for the above multiple menus are as follows:

<script type="text/javascript">

with(menuStyle=new mm_style()){
onbgcolor="#4F8EB6";
oncolor="#ffffff";
offbgcolor="#DCE9F0";
offcolor="#515151";
bordercolor="#296488";
borderstyle="solid";
borderwidth=1;
separatorcolor="#2D729D";
separatorsize="1";
fontstyle="normal";
fontfamily="Verdana, Tahoma, Arial";
subimage="/images/arrow.gif";
}

with(milonic=new menuname("Sub Menu 1")){
   style=menuStyle;
   aI("text=Sub 1 Item 1;");
   aI("text=Sub 1 Item 2;");
   aI("text=Sub 1 Item 3;");
}

with(milonic=new menuname("Sub Menu 2")){
   style=menuStyle;
   aI("text=Sub 2 Item 1;");
   aI("text=Sub 2 Item 2;");
   aI("text=Sub 2 Item 3;");
}
drawMenus() // Draw the sub menus first.

with(milonic=new menuname("Main Menu 1")){
   style=menuStyle;
   alwaysvisible=1;
   orientation="horizontal";
   position="relative";
   aI("text=Menu 1;url=http://www.milonic.com/;status=Back To Home Page;target=_blank");
   aI("text=Sub Menu 1;showmenu=sub menu 1;");
}
drawMenus(); // Then draw the first main menu.

with(milonic=new menuname("Main Menu 2")){
   style=menuStyle;
   alwaysvisible=1;
   orientation="horizontal";
   position="relative";
   aI("text=Menu 2;url=http://www.milonic.com/;status=Back To Home Page;target=_blank");
   aI("text=Sub Menu 2;showmenu=sub menu 2;");
}
drawMenus(); // Then draw the second sub menu.

</script>


If you examine the above Menu Data you will see that there are 3 instances of the drawMenus command. The reason for this is because we want to build certain menus in certain positions on the web page. The first drawMenus command builds the sub menus at the top of the page, the other drawMenus commands are executed where you want the menu to appear.

Here is the what the above menu data is doing

First we need to declare the sub menus and draw them on the web page. This is most preferably done just after the <BODY> tag because this will remove any possible conflicts with other objects on the page.

Then we declare and draw the first Main Menu. This menu is relative in position and will be placed in a position determined by the browser in accordance with page content flow. This menu could equally have been placed in any location on the web page by removing the position="relative"; property and declaring top and left properties.

Finally, the second Main Menu is declared and then drawn to the page using another drawMenus command.

As you can see the drawMenus command is used to insert the menu at an exact point in the HTML page. So all you need to do is declare the menu, then insert it with drawMenus();

The above principle can be used for inserting main menus inside table cells.

Tables Based Multiple Menus

If you need to include several menus inside table cells you could do it in a similar way to the way the following sample works..

Some Text Between the Tables
Some Text inside a table cell

The code for multiple menus placed inside table cells will look something like this:

<script type="text/javascript">

with(menuStyle=new mm_style()){
onbgcolor="#4F8EB6";
oncolor="#ffffff";
offbgcolor="#DCE9F0";
offcolor="#515151";
bordercolor="#296488";
borderstyle="solid";
borderwidth=1;
separatorcolor="#2D729D";
separatorsize="1";
padding=5;
fontfamily="Verdana, Tahoma, Arial";
subimage="/images/arrow.gif";
}

with(milonic=new menuname("T Sub Menu 1")){
   style=menuStyle;
   aI("text=Sub 1 Item 1;");
   aI("text=Sub 1 Item 2;");
   aI("text=Sub 1 Item 3;");
}

with(milonic=new menuname("T Sub Menu 2")){
   style=menuStyle;
   aI("text=Sub 2 Item 1;");
   aI("text=Sub 2 Item 2;");
   aI("text=Sub 2 Item 3;");
}
drawMenus() // Draw the sub menus first.

</script>

<table border="1">
   <tr>
      <td>
         <script type="text/javascript">
         with(milonic=new menuname("T Main Menu 1")){
            style=menuStyle;
            alwaysvisible=1;
            orientation="horizontal";
            position="relative";
            aI("text=Menu 1;url=http://www.milonic.com/;status=Back To Home Page;target=_blank");
            aI("text=Sub Menu 3;showmenu=T sub menu 1;");
         }
         drawMenus(); // Then draw the first main menu.
         </script>
      </td>
   </tr>
</table>

Some Text Between the Tables

<table border="1">
   <tr>
      <td> Some Text inside a table cell</td>
      <td>
         <script type="text/javascript">
         with(milonic=new menuname("T Main Menu 2")){
            style=menuStyle;
            alwaysvisible=1;
            orientation="horizontal";
            position="relative";
            aI("text=Menu 4;url=http://www.milonic.com/;status=Back To Home Page;target=_blank");
            aI("text=Sub Menu 2;showmenu=T sub menu 2;");
         }
         drawMenus(); // Then draw the second sub menu.
         </script>
      </td>
   </tr>
</table>


For more information on table based menus, visit http://www.milonic.com/tablemenu.php
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