html - Javascript .className not working -


i'm trying use bit of js change class of links referring current url. seems work halfway, .classname bit won't work. if use a[i].innerhtml = 'activelink' example, change innerhtml. firebug reports no errors.

window.onload = activatecurrentlink;  function activatecurrentlink(){     var = document.getelementsbytagname("a");     for(var i=0;i<a.length;i++)         if(a[i].href == window.location.href.split("#")[0])             a[i].classname += 'activelink'; } 

i have admit copypasta, js knowledge very, limited. help?

you forget space symbol necessary when adding additional class element

a[i].classname += ' activelink'; 

Comments

Popular posts from this blog

python - mat is not a numerical tuple : openCV error -

c# - MSAA finds controls UI Automation doesn't -

wordpress - .htaccess: RewriteRule: bad flag delimiters -