Try the following
var all = document.getElementsByClassName('someClass');
for (var i = 0; i < all.length; i++) {
all[i].style.color="red";
}
Note: As Cheery pointed out getElementsByClassName won’t work in IE. The linked question has a nice way to work around this limitation
- javascript document.getElementsByClassName compatibility with IE