Results 1 to 7 of 7

Thread: Top Navigational (Smart Menu)

  1. #1
    Join Date
    Apr 2005
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Top Navigational (Smart Menu)



    Can someone help me? I'm trying to get the links to go into a different frame but I am not sure how. I would help if I were more familiar with javascript than I am. But since I am not, perhaps someone can help me.

    Please email me or contact me on MSN preferably.

    http://dynamicdrive.com/dynamicindex1/sm/index.htm

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    You don't really need JavaScript knowledge to open this menu's links in a different target than the menu's frame or window. In the sample menucontext.js you will see several instances of "_blank" at the end of the some menu sub item declarations. That is the target, in this case a new window. If you want to target a frame on the existing page called 'bottom', just put that in there instead, like:
    Code:
    menu.addSubItem("webmasterid", "Freewarejava.com", "Freewarejava.com",  "http://www.freewarejava.com/", "bottom");
    of course you need a frameset page (a page with frames on it) and one of those frames needs to have the name 'bottom'.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Apr 2005
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Heh... I know what framesets are I know html lol

    just not javascript.

    by the way thank you very much for responding so quickly

  4. #4
    Join Date
    Apr 2005
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    *sighs*

    Ok now that problem is solved. I'm having problems with editing the code so that the menu suits my needs.

    Ie. when I edit the content of the menu, it only shows 3 of however many submenus I need.

  5. #5
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Without seeing your code, it is hard to be sure what the problem is. However, the most common cause is a syntax error. Like leaving out a closing or beginning quote, a comma or parenthesis.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  6. #6
    Join Date
    Apr 2005
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    When I edit the code and view it in the sample page, it works just fine. But when I put it into my site pages, it doesn't show all of the menu.

    This is the page that has the menu in it. (Am using framesets)

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <title>Napanee Downtown - Business Area Improvement Corporation</title>
    <link href="biacss.css" rel="stylesheet" type="text/css">

    <style>
    all.clsMenuItemNS, .clsMenuItemIE{text-decoration: none; font: bold 12px Arial; color: white; cursor: hand; z-index:100}
    #MainTable A:hover {color: yellow;}
    </style>

    <script language="JavaScript">

    //Top Nav Bar I v2.1- By Constantin Kuznetsov Jr.
    //Modified by Dynamic Drive for various improvements
    //Visit http://www.dynamicdrive.com for this script

    var keepstatic=1 //specify whether menu should stay static 0=non static (works only in IE4+)
    var menucolor="#000000" //specify menu color
    var submenuwidth=150 //specify sub menus' color

    </script>

    </head>
    <body marginwidth="0" marginheight="0" leftmargin="0" topmargin="0">

    <script language="JavaScript" src="menu.js"></script>
    <script language="JavaScript" src="menucontext.js"></script>
    <script language="JavaScript">
    showToolbar();
    </script>
    <script language="JavaScript">
    function UpdateIt(){
    if (ie&&keepstatic&&!opr6)
    document.all["MainTable"].style.top = document.body.scrollTop;
    setTimeout("UpdateIt()", 200);
    }
    UpdateIt();
    </script>
    </body>
    </html>






    this is the menucontext.js file.

    //Top Nav bar script v2.1- http://www.dynamicdrive.com/dynamicindex1/sm/index.htm

    function showToolbar()
    {
    // AddItem(id, text, hint, location, alternativeLocation);
    // AddSubItem(idParent, text, hint, location, linktarget);

    menu = new Menu();
    menu.addItem("homeid", "Home", "Home", null, null);
    menu.addItem("eventsid", "Events", "Events", null, null);
    menu.addItem("projectsid", "Projects", "Projects", null, null);
    menu.addItem("landmarksid", "Landmarks", "Landmarks", null, null);
    menu.addItem("recreationid", "Recreation", "Recreation", null, null);
    menu.addItem("resourceid", "Resources", "Resources", null, null);

    menu.addSubItem("homeid", "Home", "Home", "home.htm", "mainFrame");
    menu.addSubItem("homeid", "Contacts", "Contacts", "contacts.htm", "mainFrame");
    menu.addSubItem("homeid", "Feedback", "Feedback", "feedback.htm", "mainFrame");

    menu.addSubItem("eventsid", "Scarecrow Festival", "Scarecrow Festival", "scarecrow.htm", "mainFrame");
    menu.addSubItem("eventsid", "Christmas Caroling and Light Display", "Christmas Caroling and Light Display", "christmas.htm", "mainFrame");
    menu.addSubItem("eventsid", "Music By The River", "Music By The River", "music.htm", "mainFrame");
    menu.addSubItem("eventsid", "Celtic Festival", "Celtic Festival", "celtic.htm", "mainFrame");
    menu.addSubItem("eventsid", "Santa Claus Parade and Hometown Christmas", "Santa Claus Parade and Hometown Christmas", "santa.htm", "mainFrame");

    menu.addSubItem("projectsid", "Urban Renewal", "Urban Renewal", "urban.htm", "mainFrame");
    menu.addSubItem("projectsid", "Business Retention and Expansion", "Business Retention and Expansion", "bre.htm", "mainFrame");
    menu.addSubItem("projectsid", "Beautification", "Beautification", "beautification.htm", "mainFrame");
    menu.addSubItem("projectsid", "Community Vegetable Garden", "Community Vegetable Garden", "veggie.htm", "mainFrame");

    menu.addSubItem("landmarksid", "McPherson House", "McPherson House", "house.htm", "mainFrame");
    menu.addSubItem("landmarksid", "Lennox and Addington County Courthouse", "Lennox and Addington County Courthouse", "court.htm", "mainFrame");
    menu.addSubItem("landmarksid", "Lennox and Addington County Museum", "Lennox and Addington County Museum", "museum.htm", "mainFrame");
    menu.addSubItem("landmarksid", "Napanee Town Hall", "Napanee Town Hall", "hall.htm", "mainFrame");
    menu.addSubItem("landmarksid", "Old Post Office", "Old Post Office", "postoffice.htm", "mainFrame");
    menu.addSubItem("landmarksid", "Springside Park", "Springside Park", "park.htm", "mainFrame");
    menu.addSubItem("landmarksid", "Gibbards Furniture Warehouse", "Gibbards Furniture Warehouse", "gibbards.htm", "mainFrame");
    menu.addSubItem("landmarksid", "Hay Bay Historic Church", "Hay Bay Historic Church", "church.htm", "mainFrame");
    menu.addSubItem("landmarksid", "Napanee Trainstation", "Napanee Trainstation", "trainstation.htm", "mainFrame");

    menu.addSubItem("recreationid", "Outdoor Pool", "Outdoor Pool", "pool.htm", "mainFrame");
    menu.addSubItem("recreationid", "The Boulevard Cinema", "The Boulevard Cinema", "cinema.htm", "mainFrame");
    menu.addSubItem("recreationid", "Sports", "Sports", "sports.htm", "mainFrame");

    menu.addSubItem("resourceid", "Lennox and Addington County Library", "Lennox and Addington County Library", "library.htm", "mainFrame");
    menu.addSubItem("resourceid", "Napanee Archives", "Napanee Archives", "archives.htm", "mainFrame");

    menu.showMenu();
    }
    Last edited by Raethis; 04-14-2005 at 04:33 PM.

  7. #7
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    OK, that code is obviously fine then (tested it but, if it works on the sample page as you said, I needn't have bothered - just being sure). So the most common cause (syntax error) is not at work here. From what you have said it sounds as though another common problem is the culprit - trying to get the menu to span frames. Are the 'lost' sub menu items simply being cut off by the frameset layout, attempting to appear on another frame? This they cannot do. Either make the frame containing the menu taller or use it without frames. Still can't be 100% sure without seeing the whole setup but, I am pretty sure at this point.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

Bookmarks

Posting Permissions

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