Click to See Complete Forum and Search --> : getElementId("myId") Arrays?


kopite
08-21-2003, 07:30 AM
Hi,

I have four elements all with the same id, I wish to loop through the collection of values that each element has, is that possible on the js side?

e.g.
<input type=text id="myId" value=9>
<input type=text id="myId" value=12>
<input type=text id="myId" value=36>
<input type=text id="myId" value=42>

document.getElementId("myId").value only returns me the first value, i.e. "9". What is the code to get all the collection of values?

Cheers!

pyro
08-21-2003, 07:32 AM
You can only use each ID once on a page.

Charles
08-21-2003, 07:33 AM
You're not supposed to give more than one element a given id but try "getElementsByName".