function getElementsByClassName(fatherId, tagName, classNames){ var node = fatherId && document.getElementById(fatherId) || document; classNames = classNames.split(" "); var elements = node.getElementsByTagName(tagName); var result = []; for(var i=0,j=elements.length,k=0; i<j; i++){ var element = elements[i]; if (element.className == "") continue; for (var index in classNames) { if (classNames[index] == element.className) { result[k++] = element; continue; } } } return result; }