57 users online (0 members and 57 guests)  


  Results 1 to 8 of 8

Related

  1. Replies: 0
  2. Dropdown menu hides behind dropdown box    Forum: Javascript Forum
    Replies: 0
  3. MouseOver Dropdown Menu    Forum: Javascript Forum
    Replies: 3
  4. Ignore code and link greeting note code    Forum: HTML Forum
    Replies: 3
  1. #1
    jaygg1's Avatar
    New User

    Status
    Offline
    Join Date
    May 2003
    Posts
    8

    Help with mouseover dropdown code please

    I need help with the dropdown menu code that can be found at http://www.dynamicdrive.com/dynamicindex1/topnavbar.htm
    If you scroll down you will eventually come to a apart where it says targeting the links in the frames. Then it shows the code so you can target frames with the mouseover dropdown,

    javascript:parent.framename.location='http://dynamicdrive.com'

    My question is, where would I put that code in the dropdown menu code? I've tried putting it several places, but it doesn't work.
    Please help!
    thanks.

  2. #2
    QuietDean's Avatar
    Administrator

    Status
    Offline
    Join Date
    Oct 2000
    Location
    Bournemouth, UK
    Posts
    2,662
    Hiya.

    The code is well written, and clever enough to figure out that if a link starts with javascript: then it should be executed, not just linked to.

    So the answer is you put the above code where you normally put the links in. Just replace the link with

    Code:
    javascript:parent.framename.location='http://dynamicdrive.com'
    but tailored to suit your needs.

    if you still have trouble, post your version of the code so we can see whats up.
    If one of our members helps you, please click the icon to add to their reputation!
    No support via email or private message - use the forums!
    Before you ask, have you Searched?

  3. #3
    jaygg1's Avatar
    New User

    Status
    Offline
    Join Date
    May 2003
    Posts
    8
    Okay I'm still having trouble so here's my code (I'll probably change the colors and stuff later)

    <script language="JavaScript" src="navcond.js"></script>
    <script language="JavaScript">

    /*
    Top Navigational Bar II (By Mike Hall)
    Last updated: 00/05/08
    Permission granted and modified by Dynamicdrive.com to include script in archive
    For this and 100's more DHTML scripts, visit http://dynamicdrive.com
    */

    var myNavBar1 = new NavBar(0);
    var dhtmlMenu;

    //define menu items (first parameter of NavBarMenu specifies main category width, second specifies sub category width in pixels)
    //add more menus simply by adding more "blocks" of same code below

    dhtmlMenu = new NavBarMenu(100, 120);
    dhtmlMenu.addItem(new NavBarMenuItem("Headquarters", ""));
    dhtmlMenu.addItem(new NavBarMenuItem("Updates", "updates.htm"));
    dhtmlMenu.addItem(new NavBarMenuItem("Rules", "rules.htm"));
    dhtmlMenu.addItem(new NavBarMenuItem("Join the roster", "join.htm"));
    dhtmlMenu.addItem(new NavBarMenuItem("Staff", "staff.htm"));
    dhtmlMenu.addItem(new NavBarMenuItem("Roster", "roster.htm"));
    dhtmlMenu.addItem(new NavBarMenuItem("Champions", "champs.htm"));
    dhtmlMenu.addItem(new NavBarMenuItem("Newsline", "news.htm"));
    myNavBar1.addMenu(dhtmlMenu);

    dhtmlMenu = new NavBarMenu(110, 120);
    dhtmlMenu.addItem(new NavBarMenuItem("Television", ""));
    dhtmlMenu.addItem(new NavBarMenuItem("Adrenaline preview", "adrenaline.htm"));
    dhtmlMenu.addItem(new NavBarMenuItem("Adrenaline results", "adrenalineres.htm"));
    dhtmlMenu.addItem(new NavBarMenuItem("PPV - The Prophecy", "PPV.htm"));
    dhtmlMenu.addItem(new NavBarMenuItem("PPV Calendar", "calendar.htm"));
    myNavBar1.addMenu(dhtmlMenu);

    dhtmlMenu = new NavBarMenu(100, 150);
    dhtmlMenu.addItem(new NavBarMenuItem("Interactive", ""));
    dhtmlMenu.addItem(new NavBarMenuItem("Create a Tag-Team", "tag.htm"));
    dhtmlMenu.addItem(new NavBarMenuItem("Create a stable", "stable.htm"));
    dhtmlMenu.addItem(new NavBarMenuItem("Submit a storyline", "storyline.htm"));
    dhtmlMenu.addItem(new NavBarMenuItem("Submit newsline content", "submitnews.htm"));
    dhtmlMenu.addItem(new NavBarMenuItem("Submit match interference", "interfere.htm"));
    myNavBar1.addMenu(dhtmlMenu);

    dhtmlMenu = new NavBarMenu(100, 150);
    dhtmlMenu.addItem(new NavBarMenuItem("History", ""));
    dhtmlMenu.addItem(new NavBarMenuItem("Main History", "history.htm"));
    dhtmlMenu.addItem(new NavBarMenuItem("Title History", "titles.htm"));
    dhtmlMenu.addItem(new NavBarMenuItem("Result Archives", "archives.htm"));
    dhtmlMenu.addItem(new NavBarMenuItem("Blacklist", "blacklist.htm"));
    myNavBar1.addMenu(dhtmlMenu);

    //set menu colors
    myNavBar1.setColors("#000000", "#000000", "#C0C0C0", "#ffffff", "#666666", "#000000", "#cccccc", "#ffffff", "#000080")

    //uncomment below line to center the menu (valid values are "left", "center", and "right"
    //myNavBar1.setAlign("center")

    var fullWidth;

    function init() {

    // Get width of window, need to account for scrollbar width in Netscape.

    fullWidth = getWindowWidth()
    - (isMinNS4 && getWindowHeight() < getPageHeight() ? 16 : 0);

    myNavBar1.resize(fullWidth);
    myNavBar1.create();
    myNavBar1.setzIndex(2);
    //UNCOMMENT BELOW LINE TO MOVE MENU DOWN 50 pixels
    //myNavBar1.moveTo(0, 50);
    }
    </script>

  4. #4
    QuietDean's Avatar
    Administrator

    Status
    Offline
    Join Date
    Oct 2000
    Location
    Bournemouth, UK
    Posts
    2,662
    Hi.

    try changing the -

    Code:
    dhtmlMenu.addItem(new NavBarMenuItem("Submit a storyline", "storyline.htm"));
    'storyline.htm' to the javascript line mentioned above.
    If one of our members helps you, please click the icon to add to their reputation!
    No support via email or private message - use the forums!
    Before you ask, have you Searched?

  5. #5
    jaygg1's Avatar
    New User

    Status
    Offline
    Join Date
    May 2003
    Posts
    8
    Hmm, tried that, then when I tested the link, it just brought me to an error page. Maybe this will help, this is the URL for the test page - http://www31.brinkster.com/infusionw/maintest.htm
    Sorry if I'm annoying, I'm not too great with HTML.

  6. #6
    QuietDean's Avatar
    Administrator

    Status
    Offline
    Join Date
    Oct 2000
    Location
    Bournemouth, UK
    Posts
    2,662
    Ahha.

    In your code, you have copied exactly what was on the forum-

    Code:
    java script
    The forum software automatically adds a space between java and script to prevent hacking.

    However, you did not know this sorry, I should have mentioned it.

    Amend your code to remove the space between java and script and it should work fine

    PS: Annoying? I come to this forum to help people. All the regulars here do. If people like yourself stopped being 'annoying' this board would be dead Welcome to the forums. Pop back, maybe you will be able to help some people out too
    If one of our members helps you, please click the icon to add to their reputation!
    No support via email or private message - use the forums!
    Before you ask, have you Searched?

  7. #7
    Asimo's Avatar
    New User

    Status
    Offline
    Join Date
    Jul 2003
    Posts
    1
    I used this code and it worked just fine. Thanks. I have a question though. I would like to make the dropdown menu stay at the top of the page no matter what link you choose. In other words, the links in the dropdown menu open underneath the menu, not in a new page. Any ideas on how I can do that?

  8. #8
    HTML's Avatar
    Administrator

    Status
    Offline
    Join Date
    Aug 2000
    Posts
    3,445

    Follow HTML On Twitter Add HTML on Facebook Add HTML on Google+ Add HTML on Linkedin Visit HTML's Youtube Channel
    Quote Originally Posted by Asimo
    I used this code and it worked just fine. Thanks. I have a question though. I would like to make the dropdown menu stay at the top of the page no matter what link you choose. In other words, the links in the dropdown menu open underneath the menu, not in a new page. Any ideas on how I can do that?

    must have missed this post, sorry. Are you wanting frames, or is it a targeting issue you are referring to?

    Dave



Tags for this Thread