[Javascript] Form with array like structure

Steve Clason stevec at topdogstrategy.com
Sun Jul 23 17:42:15 CDT 2006


Peter Lauri wrote:
> Yes that helps, I can see that I have 14 elements and that is correct.
> However, I have not been able to loop thru them? How do I do that? I tried
> the following:
> 
> var inputelements = document.getElementsByTagName("input");
> 
> for(var i=0, len=inputelements.length; i<len; i++) {
> 	document.write(inputelements[i].value+"<br>");	
> }
> 
> But that did not work :/

Try:

var inputelements = document.getElementsByTagName("input");

for(var i=0, i<inputelements.length; i++) {
   document.write(inputelements[i].value+"<br>");	
}

--
Steve Clason
Web Design & Development
Boulder, Colorado, USA
www.topdogstrategy.com
(303)818-8590




More information about the Javascript mailing list