getElementByClass().setAttribute doesn't work
- by Syom
why when i write
document.getElementByClass('home1').setAttribute('style', 'background-image:url(img/red_menu.PNG);');
it doesn't work?
i have the element with class="home1"
with document.getElementById('home1')...
works fine
thanks
EDIT:
and when i wrote
document.getElementByClassName('home1').setAttribute,
i have a javascript error
Error: document.getElementsByClassName("home1").setAttribute is not a function