[thelist] Address TD by id ?

Peter Duchateau peter at duo.be
Tue Aug 20 08:00:01 CDT 2002


When I have a TDs like this

<td id="user_td" onclick="changeActive('user'); return true;"
class="topInactive"><a id="user_link" href="user.dhtml" class="topInactive"
target="content_frame">User Page</a>&nbsp;</td>

The home, sitemap en admin TDs look about the same.

AND

function changeActive(link) {

    top.home_link.className = "topInactive";
    user_link.className = "topInactive";
    sitemap_link.className = "topInactive";
    admin_link.className = "topInactive";
    home_td.className = "topInactive";
    user_td.className = "topInactive";
    sitemap_td.className = "topInactive";
    admin_td.className = "topInactive";

    switch(link) {
        case "home": home_link.className = "topActive";
                     home_td.className = "topActive";
                     break;
        case "user": user_link.className = "topActive";
                     user_td.className = "topActive";
                     break;
        case "sitemap": sitemap_link.className = "topActive";
                         sitemap_td.className = "topActive";
                         break;
        case "admin": admin_link.className = "topActive";
                      admin_td.className = "topActive";
                      break;
    }
    refresh_form.active_link.value = link;
}


In Internet Explorer the function works: the class of the TD and the A are
changed.
In Mozilla I get "Error: home_link is not defined" in the javascript
console.

How can I address the TDs and As then in Mozilla ?


Peter




More information about the thelist mailing list