1<!-- html -->
2<a class="test" name="Name 1"></a>
3<a class="test" name="Name 2"></a>
4<a class="test" name="Name 3"></a>
5
6// javascript
7var elements = document.getElementsByClassName("test");
8var names = '';
9for(var i=0; i<elements.length; i++) {
10 names += elements[i].name;
11}
12document.write(names);
13