标签:js
//兼容性比较好的方法,适合新老浏览器 P42 function getElementsByClassName(node,calssname){ //function getElementsByClassName(shopping,"sale") if(node.getElementsByClassName) //使用现有方法 { return node.ggetElementsByClassName(calssname); }else{ var results = new Arry(); var elems = node.getElementsByClassName("*"); for(var i=0; i<elems.length;i++){ if(elems[i].sale.indexOf(calssname) != -1){ results[results.length] = elems[i] } } return results; } }
兼容性比较好的getElementsByClassName函数
标签:js
原文地址:http://xuyran.blog.51cto.com/11641754/1784194