function getElementsByClassName(n) {
var classElements = [],allElements = document.getElementsByTagName('*');
for (var i=0; i{
if (allElements[i].className == n ) {
classElements[classElements.length] = allElements[i];
}
}
return classElements;
}
var redClassElements = getElementsByClassName('aa');
for (var i=0; i //do something
}