if(!document.getElementsByClassName){
document.getElementsByClassName = function(className, element){
var children = (element || document).getElementsByTagName('*');
var elements = new Array();
for(var i=0; i<children.length; i++){
var child = children[i];
var classNames = children.className.split(' ');
for(var j=0; j<classNames.length; j++){
if(classNames[j] == className){
elements.push(child);
break;
}
}
return elements;
};
}
注:className 属性 DOM标准属性(className, title, dir , lang):设置或返回元素的class