Revision: 27241
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at May 31, 2010 14:14 by blpgirl
Initial Code
function getElementsByClass( searchClass, domNode, tagName) { if (domNode == null) domNode = document; if (tagName == null) tagName = '*'; var el = new Array(); var tags = domNode.getElementsByTagName(tagName); var tcl = " "+searchClass+" "; for(i=0,j=0; i<tags.length; i++) { var test = " " + tags[i].className + " "; if (test.indexOf(tcl) != -1) el[j++] = tags[i]; } return el;
Initial URL
http://www.anyexample.com/webdev/javascript/javascript_getelementsbyclass_function.xml
Initial Description
Initial Title
get elements by class
Initial Tags
Initial Language
JavaScript