I like Dean Edwards' cssQuery() for stuff like that.
http://dean.edwards.name/my/cssQuery/
Basically it will get all elements using a CSS selector and returns an array of nodes that match the selector.
// query a class name
var tags = cssQuery('div.classname');
for (var i in tags)
{
// Do stuff
tags[i].style.background = 'blue';
}
You can also do stuff like this:
var tags = cssQuery('div > span.directchild');
var tags = cssQuery('div div.descendant');
It is also cross-platform, and works in IE, Firefox, Opera, and Safari.
HTH!
Regards,
Rich
--
[
http://www.smilingsouls.net]
Mail_IMAP: A PHP/C-Client/PEAR solution for webmail
Author: Beginning CSS: Cascading Style Sheets For Web Design