Javascript problems

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
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>
    <li><a href="#">Services</a>
      <ul id="nav">
        <li><a href="#">Web Design</a></li>
        <li><a href="#">Internet
        <li><a href="#">Hosting</a></li>
        <li><a href="#">Domain Names</a></li>
        <li><a href="#">Broadband</a></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><a href="#">France</a></li>
        <li><a href="#">USA</a></li>
        <li><a href="#">Australia</a></li>

Re: Javascript problems

Peter wrote:
Quoted text here. Click to load it

Whoa! STOP! Check the spec!

id = name [CS]
     This attribute assigns a name to an element. This name must be
*unique* in a document.

Take care,

Re: Javascript problems

thanks.  Will begin to rewrite now!

Site Timeline