View Single Post
  #5 (permalink)  
Old Sep 23rd, 2007, 11:52
spinal007's Avatar
spinal007 spinal007 is offline
Moderator
Join Date: Mar 2004
Location: Good Ol'London
Age: 23
Posts: 1,649
Blog Entries: 1
Thanks: 0
Thanked 4 Times in 4 Posts
Re: Problem accessing specific form elements

You don't *have* to use getElementdById, it will work the same either way. The problem is that you were looping through numbers 1 to 3 but you were looking for the same element every time.

All you have to do is change this...
itemValue = document.step1.elements['foo1'].value;

...into this:
itemValue = document.step1.elements['foo'+i].value;