Is there a way with javascript to indicate the current menu location with css?
If self.url = link.href then link.href.cssclass = current?
Something automatic rather than manually coding something in.
Is there a way with javascript to indicate the current menu location with css?
If self.url = link.href then link.href.cssclass = current?
Something automatic rather than manually coding something in.
Something like this should work.... just call it when the page loads.
Code:function checkLinks() { var anchors = document.getElementsByTagName('a'); for (var i=0; i<anchors.length; i++){ var anchor = anchors[i]; if (anchor.href == location.href){ anchor.className = "someClass"; } } }
Bookmarks