标签:blog http java javascript html cti
var getElementsByClassName = function(searchClass,node,tag) { if(document.getElementsByClassName){ return document.getElementsByClassName(searchClass) }else{ node = node || document; tag = tag || ‘*‘; var returnElements = [] var els = (tag === "*" && node.all)? node.all : node.getElementsByTagName(tag); var i = els.length; searchClass = searchClass.replace(/\-/g, "\\-"); var pattern = new RegExp("(^|\\s)"+searchClass+"(\\s|$)"); while(--i >= 0){ if (pattern.test(els[i].className) ) { returnElements.push(els[i]); } } return returnElements; } } //调用方法 var shiToolBox=document.getElementsByClassName("aaa");
原分享地址:http://www.cnblogs.com/rubylouvre/archive/2009/07/24/1529640.html
兼容ie5-ie11及其他主流浏览器的js document.getElementsByClassName 方法,布布扣,bubuko.com
兼容ie5-ie11及其他主流浏览器的js document.getElementsByClassName 方法
标签:blog http java javascript html cti
原文地址:http://www.cnblogs.com/frozen/p/3815205.html