Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    May 2009
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Need help with drop down menu

    Hi. Following is the code I'm having trouble with. The issue is that I'm having difficulty with creating a submenu under "Terrazzo Tiles" that includes "Polished" and "Etched." You'll see the Terrazzo menu item in "menus[4]" and attempted drop down at "menus[9]". I would appreciate your help. Thanks.

    ------------------------------------------------
    <script language="JavaScript1.2" type="text/javascript">
    <!--
    sniffBrowsers();

    menuItemBullet = new bulletPoint("bullets/one/menu_off.gif","bullets/one/menu_on.gif");
    labelBullet = new bulletPoint("bullets/one/header_off.gif","bullets/one/header_on.gif");
    subMenuBullet = new bulletPoint("bullets/one/sub_header_off.gif","bullets/one/sub_header_on.gif");

    myTest = new menuBar('myTest',400 , 'horizontal', '#D0BFBF', '#D0BFBF');
    myTest.addLabel(null, 'HOME', 1, 50, '#D0BFBF', '#D0BFBF', 'index.shtml', 'center');
    myTest.addLabel(null, 'PEBBLES', 2, 75, '#D0BFBF', '#D0BFBF', 'pebbles.shtml', 'center');
    myTest.addLabel(null, 'NATURAL STONE', 3, 120, '#D0BFBF', '#D0BFBF', 'naturalstone.shtml', 'center');
    myTest.addLabel(null, 'DISTINCTIVE TILES', 4, 120, '#D0BFBF', '#D0BFBF', 'distinctivetiles.shtml', 'center');
    myTest.addLabel(null, 'GLASS', 5, 55, '#D0BFBF', '#D0BFBF', 'glass.shtml', 'center');
    myTest.addLabel(null, 'METAL', 7, 60, '#D0BFBF', '#D0BFBF', 'metal.shtml', 'center');
    myTest.height = 10;

    menus[1] = new menu(65, 'vertical', '#74706F', '#74706F');
    menus[1].height = 16;
    menus[1].addItem(null, 'About Us', null, 65, '#74706F', '#FFFFFF', 'aboutus.shtml', 'center');
    menus[1].addItem(null, 'Contact Us', null, 65, '#74706F', '#FFFFFF', 'contactform.asp', 'center');
    menus[1].addItem(null, 'Find a Distributor', null, 65, '#74706F', '#FFFFFF', 'distributors.shtml', 'center');
    menus[1].addItem(null, 'Gallery', null, 65, '#74706F', '#FFFFFF', 'gallery.shtml', 'center');
    menus[1].addItem(null, 'Installation', null, 65, '#74706F', '#FFFFFF', 'install.shtml', 'center');
    menus[1].addItem(null, 'Sitemap', null, 65, '#74706F', '#FFFFFF', 'sitemap_user.shtml', 'center');
    menus[1].writeMenu();

    menus[2] = new menu(60, 'vertical', '#74706F', '#74706F');
    menus[2].height = 16;
    menus[2].addItem(null, 'Tiles', null, 60, '#74706F', '#FFFFFF', 'pebbles_tiles.shtml', 'center');
    menus[2].addItem(null, 'Standing', null, 60, '#74706F', '#FFFFFF', 'pebbles_standing.shtml', 'center');
    menus[2].addItem(null, 'Borders', null, 60, '#74706F', '#FFFFFF', 'pebbles_borders.shtml', 'center');
    menus[2].writeMenu();

    menus[3] = new menu(100, 'vertical', '#74706F', '#74706F');
    menus[3].height = 16;
    menus[3].addItem(null, 'Basalt', null, 100, '#74706F', '#FFFFFF', 'basalt.shtml', 'center');
    menus[3].addItem(null, 'Cubist', null, 100, '#74706F', '#FFFFFF', 'cubist.shtml', 'center');
    menus[3].addItem(null, 'Granite', null, 100, '#74706F', '#FFFFFF', 'granite.shtml', 'center');
    menus[3].addItem(null, 'Marble', null, 100, '#74706F', '#FFFFFF', 'marble.shtml', 'center');
    menus[3].addItem(null, 'Modern', null, 100, '#74706F', '#FFFFFF', 'modern.shtml', 'center');
    menus[3].addItem(null, 'Royale Mosaics', null, 100, '#74706F', '#FFFFFF', 'royale.shtml', 'center');
    menus[3].addItem(null, 'Sandstone', null, 100, '#74706F', '#FFFFFF', 'sandstone.shtml', 'center');
    menus[3].addItem(null, 'Versailles', null, 100, '#74706F', '#FFFFFF', 'versailles.shtml', 'center');

    menus[3].writeMenu();

    menus[4] = new menu(110, 'vertical', '#74706F', '#74706F');
    menus[4].height = 16;
    menus[4].addItem(null, 'Mission Tiles', 6, 110, '#74706F', '#FFFFFF', 'mission.shtml', 'center');
    menus[4].addItem(null, 'Terracotta', null, 110, '#74706F', '#FFFFFF', 'terracotta.shtml', 'center');
    menus[4].addItem(null, 'Terrazzo Tiles', 9, 110, '#74706F', '#FFFFFF', 'terrazzo_polished.shtml', 'center');
    menus[4].writeMenu();

    menus[5] = new menu(55, 'vertical', '#74706F', '#74706F');
    menus[5].height = 16;
    menus[5].addItem(null, 'Folia', null, 55, '#74706F', '#FFFFFF', 'folia_glass.shtml', 'center');
    menus[5].addItem(null, 'Freeform', null, 55, '#74706F', '#FFFFFF', 'freeform_glass.shtml', 'center');
    menus[5].addItem(null, 'Mardi Gras', null, 55, '#74706F', '#FFFFFF', 'mardiGras_glass.shtml', 'center');
    menus[5].addItem(null, 'Opera', null, 55, '#74706F', '#FFFFFF', 'opera.shtml', 'center');
    menus[5].addItem(null, 'Piano', null, 55, '#74706F', '#FFFFFF', 'piano.shtml', 'center');
    menus[5].addItem(null, 'Pillow', null, 55, '#74706F', '#FFFFFF', 'pillow_glass.shtml', 'center');
    menus[5].writeMenu();

    menus[6] = new menu(55, 'vertical', '#74706F', '#74706F');
    menus[6].height = 16;
    menus[6].addItem(null, 'Accent', null, 55, '#74706F', '#FFFFFF', 'mission_accents.shtml', 'center');
    menus[6].addItem(null, 'Border', null, 55, '#74706F', '#FFFFFF', 'mission_border.shtml', 'center');
    menus[6].addItem(null, 'Deco', null, 55, '#74706F', '#FFFFFF', 'mission_deco.shtml', 'center');
    menus[6].addItem(null, 'Pattern', null, 55, '#74706F', '#FFFFFF', 'mission_pattern.shtml', 'center');
    menus[6].addItem(null, 'Solid', null, 55, '#74706F', '#FFFFFF', 'mission_solid.shtml', 'center');
    menus[6].writeMenu();

    menus[7] = new menu(60, 'vertical', '#74706F', '#74706F');
    menus[7].height = 16;
    menus[7].addItem(null, 'Metal Collection', null, 60, '#74706F', '#FFFFFF', 'metal.shtml', 'center');
    menus[7].writeMenu();

    menus[9] = new menu(55, 'vertical', '#74706F', '#74706F');
    menus[9].height = 16;
    menus[9].addItem(null, 'Polished', null, 55, '#74706F', '#FFFFFF', 'terrazzo_polished.shtml', 'center');
    menus[9].addItem(null, 'Etched', null, 55, '#74706F', '#FFFFFF', 'terrazzo_etched.shtml', 'center');
    menus[9].writeMenu();

    menus[1].align='center';
    menus[2].align='center';
    menus[3].align='center';
    menus[4].align='center';
    menus[5].align='center';
    menus[6].align='right';
    menus[7].align='center';
    menus[8].align='right';
    menus[9].align='right';

    //-->
    </script>

    <script language="JavaScript1.2" type="text/javascript">
    <!--
    myTest.writeMenuBar();
    //-->
    </script>

  • #2
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    26,561
    Thanks
    80
    Thanked 4,496 Times in 4,460 Posts
    You need to tell people what framework you are using. This is *NOT* standard JavaScript. Or, rather, the code is standard JavaScript, but it depends on you having loaded some library, first.

    My *GUESS* is that the issue is the first parameter of the addItem( ) calls.

    I would *guess* that this parameter designates the "parent' of the item being added, meaning that if [9] is supposed to be a submenu of [4], then you should be doing
    Code:
    menus[9].addItem(menus[4], 'Polished', null, 55, '#74706F', '#FFFFFF', 'terrazzo_polished.shtml', 'center');
    menus[9].addItem(menus[4], 'Etched', null, 55, '#74706F', '#FFFFFF', 'terrazzo_etched.shtml', 'center');
    But the more I study that code, the less I think that's the answer.

    Maybe you could find the docs for that library you are using and see what they have to say?

  • #3
    New to the CF scene
    Join Date
    May 2009
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hi Old Pedant (I love the alias by the way ),

    I tried your suggestion but, unfortunately, it did not work.

    The way the previous webmaster used this code is by putting this line in the body of a .shtml page:

    <!--#include file="_includes/install_dropDown.html" -->

    Once the .shtml page is uploaded to our server, the line is replaced by the code in my original post.

    What I want to happen is working with the following code:

    menus[4].addItem(null, 'Mission Tiles', 6, 110, '#74706F', '#FFFFFF', 'mission.shtml', 'center');

    This code does create a submenu of the following code:

    menus[6] = new menu(55, 'vertical', '#74706F', '#74706F');
    menus[6].height = 16;
    menus[6].addItem(null, 'Accent', null, 55, '#74706F', '#FFFFFF', 'mission_accents.shtml', 'center');
    menus[6].addItem(null, 'Border', null, 55, '#74706F', '#FFFFFF', 'mission_border.shtml', 'center');
    menus[6].addItem(null, 'Deco', null, 55, '#74706F', '#FFFFFF', 'mission_deco.shtml', 'center');
    menus[6].addItem(null, 'Pattern', null, 55, '#74706F', '#FFFFFF', 'mission_pattern.shtml', 'center');
    menus[6].addItem(null, 'Solid', null, 55, '#74706F', '#FFFFFF', 'mission_solid.shtml', 'center');
    menus[6].writeMenu();

  • #4
    New to the CF scene
    Join Date
    May 2009
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I figured it out.


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •