I use this code normally for having my active page’s link highlighted.. Found it on net, the author is Paul @ Yellow Pencil .com..Once you’ve attached this js to your pages, you only need to style the class .active_menu so that it has the green background and your work is done.. Hope it helped
function scriptInit() {
if (!document.getElementById) {
return;
}
}
function addEvent(elm, evType, fn, useCapture) {
if (elm.addEventListener) {
elm.addEventListener(evType, fn, useCapture);
return true;
} else if (elm.attachEvent) {
var r = elm.attachEvent(‘on’ + evType, fn);
return r;
} else {
elm[‘on’ + evType] = fn;
}
}
function checkActive() {
var a = document.getElementsByTagName(“a”);
if ([removed].href.substr(location.href.length - 1, 1) == ‘/’) {
//var loc = [removed].href + ‘index.html’;
}
else {
var loc = [removed].href;
}
for(var i=0; i < a.length; i++) {
if (a.href == loc) {
a.setAttribute(“class”, “active_menu”);
a.setAttribute(“className”, “active_menu”);
}
}
}
addEvent(window, ‘load’, checkActive, false);