View Full Version : DD Mouse Over Tab Menu: How ot make submenu active?

06-18-2010, 09:06 PM
1) Script Title:
Mouse Over Tab Menu

2) Script URL (on DD):

3) Describe problem:
I have everything working, but I want to make the SUBMENU button active after clicking on it.
I have very BASIC javascript experience, I tried a couple of options, but none of them work.
Here a link, please note only clicking on SERVICES and its submenu will work in this version:

I got the main menu active, easy, but how do I tell what button to be active in the external submenu file??

Thank you!!!



06-18-2010, 10:36 PM
I am not entirely sure how you want the "active" submenu item to look, but one thing you could do is to add the "selected" class to the link. For example on the communications page you would add it to this link

<a href="../Services/communications.htm" class="selected">Strategic Communications</a>

06-21-2010, 09:32 PM
Thank you azoomer.

I simply want the submenu button to be black, same effect as when you rollover.

With this script, the submenu navigation is an external HTML file, so adding a class=selected to this external file wouldn't make sense.
Or in other words, the communications page you are referring to DOES NOT contain the link you posted, only the external HTML file contains the submenu buttons. (http://www.flyingfish.de/dd/submenucontents.htm).

One thought I had was to just get rid of the external submenu file and insert the submenu on EACH page.
I tried that but there is too much script modification needed to make it work. I cannot do that with my basic knowledge, and might as well choose an entirely different solution then.

Who created this script anyway? Is there any way to get in touch with that person?

I just can't imagine it's not possible.

Still desperate,


06-21-2010, 09:49 PM
Yes I can see what you mean. Looking at the documentation I realize that my suggestion wouldn't work at all. I don't have any more "good" ideas right now.

06-21-2010, 11:22 PM
Thank you anyway!!

06-22-2010, 12:35 AM
I have only ever been able to do it with PHP, never with Javascript.

And in the PHP code, I essentially write an IF statement that checks the "section" a certain page is (in an external array page), and if the section is true, then the PHP writes id="current" to the link.

This is what my PHP code looks like:

<li><a <?php if ($pageID["section"]=="home") {echo "id=\"current\" ";} ?>href="index.php">Home</a></li>

However, it can't be that difficult to redo in Javascript. I would think that if you made an id on every body tag, and then wrote a function that read against which id was which, that would do it.

But I don't actually know enough about Javascript to write it out myself.

07-03-2010, 06:53 AM
I have exactly the same issue/requirement but have no PHP and only minimal JS. I'm able to pass a parameter through to the external submenu and read it using the script:

var subMenuCurrent=location.search.substr(1).split("?");

But then I have no idea of how to write the Javascript which, for each line in the submenu, would say:

if subMenuCurrent = menuItemID, apply class="current" to this line.

I'm losing sleep over this, 'cos I'm sure it should be easy!