//parent是可选参数,
getByClassName:function(className,parent){
var elem = [],
node = parent != undefined&&parent.nodeType==1?parent.getElementsByTagName('*'):document.getElementsByTagName('*'),
p = new RegExp("(^|\\s)"+className+"(
\\s|$)");
for(var n=0,i=node.length;n
if(p.test(node[n].className)){
elem.push(node[n]);
}
}
return elem;
}