Javascript problems

Discussion in 'HTML' started by Peter, Apr 22, 2006.

  1. Peter

    Peter Guest

    I'm trying to implement an n-level horizontal menu. I'm having a
    problem. The ul tags are all id'd as "nav". If I go more than 1 level
    deep I can't seem locate the ul tag using Javascript. I know that may
    not be the best way to put it so I'll throw some code down. Where text
    is "London" is where I can't get to in the DOM using Javascript.
    Ideally, I'd like to make a recursive Javascript function to find and
    appropriately handle each node, no matter how nested the lists become.
    Any advice would be appreciated.

    <ul id="nav">
    <li><a href="#">Home</a></li>
    <li><a href="#">About</a>
    <ul id="nav">
    <li><a href="#">History</a></li>
    <li><a href="#">Team</a></li>
    <li><a href="#">Offices</a></li>
    </ul>
    </li>
    <li><a href="#">Services</a>
    <ul id="nav">
    <li><a href="#">Web Design</a></li>
    <li><a href="#">Internet
    Marketing</a></li>
    <li><a href="#">Hosting</a></li>
    <li><a href="#">Domain Names</a></li>
    <li><a href="#">Broadband</a></li>
    </ul>
    </li>
    <li><a href="#">Contact Us</a>
    <ul id="nav">
    <li><a href="#">United Kingdom</a>
    <ul id="nav"><li><a href="#">London</a></li></ul>
    </li>
    <li><a href="#">France</a></li>
    <li><a href="#">USA</a></li>
    <li><a href="#">Australia</a></li>
    </ul>
    </li>
    </ul>
    Peter, Apr 22, 2006
    #1
    1. Advertising

  2. Jonathan N. Little, Apr 22, 2006
    #2
    1. Advertising

  3. Peter

    Peter Guest

    thanks. Will begin to rewrite now!
    Peter, Apr 22, 2006
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jeronimo Bertran

    Using C# script instead of JavaScript problems

    Jeronimo Bertran, Nov 15, 2003, in forum: ASP .Net
    Replies:
    2
    Views:
    13,703
    -=Chris=-
    Nov 15, 2003
  2. john
    Replies:
    1
    Views:
    6,513
    bruce barker
    Apr 20, 2004
  3. Susan Baker
    Replies:
    2
    Views:
    806
    kelvSYC
    Jun 26, 2005
  4. Shelly

    Problems, problems for newbie

    Shelly, Sep 2, 2007, in forum: ASP .Net
    Replies:
    1
    Views:
    2,178
    Shelly
    Sep 3, 2007
  5. Sak Na rede
    Replies:
    0
    Views:
    412
    Sak Na rede
    Jan 30, 2009
Loading...

Share This Page