In JavaScript if you give things the same name, it makes a collection, then you can reference them like:
document.myform.name[0].value for the first one, document.myform.name[1].value for the second etc...
document.myform.name.length should give you the number of items in the collection (unless you already know this), then you can loop around appending it to a string.
mystring = '';
for (i=0; i<document.myform.name.length; i++) {
mystring = mystring + '#' + document.myform.name.value;
}
alert(mystring);
Not sure if that's the exact syntax, but you should get the idea.
HTH