Web Analytics Made Easy -
StatCounter Trying to create a vertical drop down menu... - CodingForum

Announcement

Collapse
No announcement yet.

Trying to create a vertical drop down menu...

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Trying to create a vertical drop down menu...

    Hello,
    I don't have a lot of formal experience with javascript and I was wondering if anyone could help me out with this menu I'm trying to create.

    What I've been using is multiple header pages, and each page would include the tag in the header to say which page to load (ie- header.asp, header1.asp etc) Each header would include or not include the submenus I wanted to be shown at the time. It's getting to the point I have to make a lot of headers so I know there must be an easier way.

    What I want the menu parts to do is open a page on click, as well as show the submenu. I'd like the submenu to continue to show when you are looking at the submenu pages. With my other method this was easy, they would all pull the header with that subsection in it, but I'd rather just have one header.

    What I've tried to far is to create DIVs for all my submenus with identifiers (submenu1, submenu2 etc) and set the class to hide. All my pages have identifiers on them that effect the menu text:
    <%
    dim thispage
    thispage = "info"
    %>
    I'd like a script that would say If this page = info then change DIV submenu1's class to show.

    Does that make sense? I'm having a hard time creating it on my own since I don't know javascript well.

  • #2
    In the head section of each page.
    PHP Code:
    <script type="text/javascript">
        
    showMenu "info"//change this value on different pages.
    </script
    In the body section where your menus go
    PHP Code:
    <div id="info" style="display:none">...menuGoesHere...</div>
    <
    div id="home" style="display:none">...menuGoesHere...</div>
    <
    div id="games" style="display:none">...menuGoesHere...</div>
    <
    script type="text/javascript">
        
    document.getElementById(showMenu).style.display="";
    </
    script

    Comment


    • #3
      If this doesn't work, let me know. It would be best to dynamicly output the menu via ASP (or some other server side language).
      Last edited by VortexCortex; Oct 5, 2006, 08:39 AM. Reason: typos

      Comment

      Working...
      X