Forum Moderators: open
function shareClass(tag,cn){
var A=document.getElementsByTagName(tag);
var L=A.length, B=[], tem;
for(var i=0;i<L;i++){
tem=A[i];
if(tem.className.indexOf(cn)!=-1)B.push[tem);
}
return B;
}
If for some reason you want an array of ids and not elements
change this line:
if(tem.className.indexOf(cn)!=-1)B.push[tem);
to this:
if(tem.className.indexOf(cn)!=-1)B.push[tem,id);