[Javascript] I don't know what to put down as the subject for this one...heh...

SnarfLT at aol.com SnarfLT at aol.com
Mon Jul 29 03:40:17 CDT 2002


I am creating a user-defined-number -> (x) of input text boxes on the fly.
giving them each the name service(1 - x)
example:
name=service1
name=service2
name=service3
...
name=servicex

I want to write to these boxes using the following for loop:

for (i = 1; i <= x; i++)
{
  document.mainForm.service+i+.value = "myValue";
}

...obviously that doesn't work, so i tried this:

for (i = 1; i <= x; i++)
{
  temp = "document.mainForm.service"+i+".value
  temp = "myValue";
}

that didn't work either.  I wanted to avoid using ID's but it looks like I 
have to, unless any of you can point me in another direction.


Thank you for your time,
Scott
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.evolt.org/pipermail/javascript/attachments/20020729/20bd8419/attachment.htm>


More information about the Javascript mailing list