If its a quick project, the following is easy...
HTML DOM getElementsByClassName() Method[
^]
If you'll be doing a lot of this sort of thing, you may want to check out jQuery...
jQuery Tutorial[
^]
Specifically...
jQuery .class Selector[
^]
UPDATE: I notice, after re-reading your question more carefully, that you may have tried
getElementsByClassName
. If this is the case, you should probably improve your question to indicate what
specific problem(s) you encountered. For example, did you get an error? If so, what error? Or, did it fail to behave as you expected? If so, what were your expectations and how
specifically did it fail to meet them? Otherwise, its difficult for anyone to help you beyond posting some documentation links.