1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
| if (!document.getElementsByClassName) { document.getElementsByClassName= function(cls) { var ret = []; var els = document.getElementsByTagName('*'); for (var i = 0; i < els.length; i++) { if(els[i].className === cls || els[i].className.indexOf("cls") === 0 || els[i].className.indexOf(" cls") >= 0 || els[i].className.indexOf(" cls ") > 0) { ret.push(els[i]); } } return ret; } }
|