If "home" just redirects to the index, why don't you just make the link to "home" the index? For example:
Code:
<li><a href="http://www.example.com/">Home</a></li>
Anyways, to fix this issue the hard way (strictly for learning purposes... not recommended, go with what I said above), you'd do something like:
Code:
for (var i = 0; i < document.links.length; i++) {
if (document.links[i].href === document.URL || (document.URL === "http://example.com/" && document.links[i].href === "http://example.com/home")) {
document.links[i].className = 'active';
}
}
Of course, apply whatever mechanism you use to deal with optional trailing slashes.
Bookmarks