1 function getByClass(oParent,sClass){ 2 var aEle = oParent.getElementsByTagName('*'); 3 var result = []; 4 var re = new RegExp('\b' + sClass + '\b','i'); 5 6 for(var i=0;i<aEle.length;i++){ 7 if(re.test(aEle[i].className)){ 8 result.push(aEle[i]); 9 } 10 } 11 12 return result; 13 }