window.onload = function() { var a = document.querySelectorAll('#menu_product a, #menu_service a'), i; for(i=0; i<a.length; i++) if(a[i].href == location.href) a[i].className = 'menu-link_activ'; }