Если так?
function modifyClass(className,func,param){
var objecs = document.getElementsByClassName(className);
for(i=0; i<objecs.length; i++){
var id = objecs[i].id;
if(func == 'renameClass'){
document.getElementById(id).className = param;
if( objecs.length > 0 ){
modifyClass(className,func,param);
}
}
}
}
function modifyClass('xxx','renameClass','yyy')