<div id="mnu"> <a href="/cat1/">link1</a> <a href="/cat2/">link2</a> <a href="/cat3/">link3</a> </div>
<html> <head> <title>example</title> </head> <body> <div> <a class="selected">1</a> <a class="selected">2</a> <a class="no-selected">3</a> <a class="selected">4</a> </div> <script> var list = document.querySelectorAll('a[class=selected]'), a; for (var i = 0; i < list.length; ++i) { a = list[i]; alert(a.innerHTML); } </script> </body> </html>
document.querySelectorAll('a[href=' + window.location.pathname + ']')
document.querySelector('a[href="/forum/"]').className = 'selected'