document.getelementbyid multiple ids code example
Example: javascript get multiple elements by id
<!-- html -->
<a class="test" name="Name 1"></a>
<a class="test" name="Name 2"></a>
<a class="test" name="Name 3"></a>
// javascript
var elements = document.getElementsByClassName("test");
var names = '';
for(var i=0; i<elements.length; i++) {
names += elements[i].name;
}
document.write(names);