var l = document.links for (var i = 0; i < l.length; i++) { if (l[i].href == location.href) { l[i].parentElement.className = 'pageYoureOn'; l[i].style.color = '#666600'; } }