getElementsByClassName:
<Body> <ul> <li id = "A1" class = "A"> AA </LI> <li id = "A2" class = "a B"> AA </LI> <li id = "A3" class = "aa a B"> AA </LI> </ul> <Div class = "A"> afdafaf </div> <SCRIPT type = "text/JavaScript"> var getelementsbyclassname = function (classname, node, tag) {var node = node | document, nodes, Res = [], match = false, eles, ELE, classes; If (document. getelementsbyclassname) {nodes = node. getelementsbyclassname (classname); If (typeof tag! = "Undefined") {for (VAR I = 0, Len = nodes. length; I <Len; I ++) {var node = nodes [I]; If (tag! = "*" & Node. tagname = tag. touppercase () {res. push (node) ;}} else {res = nodes ;}} else {tag = tag | "*"; classes = classname. split (""); eles = (TAG = "*" & node. all )? Node. ALL: node. getelementsbytagname (TAG); match = false; // compare loops // For (VAR I = eles. length; I> 0; I --) {for (VAR I = 0, Elen = eles. length; I <Elen; I ++) {var ele = eles [I]; for (VAR K = 0, klen = classes. length; k <klen; k ++) {match = new Regexp ("(^ | \ s)" + classes [k] + "(\ s | $) "). test (Ele. classname ). replace (/(^ \ s +) | (\ s + $)/, ""); If (! Match) break;} If (MATCH) res. push (Ele) ;}} return res ;}// instance: Alert (getelementsbyclassname ("A", document, "Li "). length );