高级浏览器已经支持了getElementsByClassName,所以如果支持就使用getElementsByClassName,如果不支持则通过循环选择
function getElementsByClassName(node,classname){ if(node.getElementsByClassName){ return node.getElementsByClassName(classname); }else{ var results = new Array(); var elems = node.getElementsByTag("*"); for (var i=0;i<elems.length;i++){ if(elems[i].className.indexOf(classname) != -1){ results[elems.length] = elems[i]; } } return results; } }