1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
| <script> var getByClass = function (oParent, cname) { if (oParent == null) { oParent = document; } if (oParent.getElementsByClassName) { return oParent.getElementsByClassName(cname); } else { var all = oParent.getElementsByTagName("*"); var j = all.length; var theClass = new RegExp("(^|\\s)" + cname + "(\\s|$)"); var result = new Array(); for (var i = 0; i < j; i++) { var allClass = all[i].className; if (theClass.test(allClass)) { result.push(all[i]) } } return result; } } </script>
|