heres a equivelent of document.getElementsByTagName(), except it gets all the elements with the specified class name.
[AS]
var IE = false;
if(navigator.appName.indexOf(“IE”)!=-1 && !document.hasAttribute) IE = true;
/**
*@description: gets all elements by the specified class name
*@param: name, a string specifieing the class name you want to grab
*@returns: an array of found elements if successfull, false on failure
**/
document.getElementsByClassName = function(name) {
var findStack = [];
function checkChildren(ob) {
for(var a = 0; a<ob.childNodes.length; a++) {
if(ob.childNodes[a].nodeType!=1)
continue;
if(((IE)?ob.childNodes[a].attributes['class'].nodeValue:ob.childNodes[a].getAttribute("class"))==name)
findStack.push(ob.childNodes[a]);
if(ob.childNodes[a].hasChildNodes())
checkChildren(ob.childNodes[a]);
}
}
checkChildren(this.getElementsByTagName("body")[0]);
if(findStack.length==0) return false;
return findStack;
}
[/AS]