// 网上参考的,自己修改了一部分 // 代码如下,纯JS,要求浏览器支持 getElementsByClassName 方法 复制代码 代码如下: <BR>function getElementsByClassName(classname,node){ <BR>node = node || window.document; <BR>if(node.getElementsByClassName){ <BR>return node.getElementsByClassName(classname); <BR>}else{ <BR>var results = new Array(); <BR>var elems = node.getElementsByTag("*"); <BR>for (var i=0;i<elems.length;i++){ <BR>if(elems[i].className.indexOf(classname) != -1){ <BR>results[elems.length] = elems[i]; <BR>} <BR>} <BR>return results; <BR>} <BR>}; <BR>