Links

Lists

Latest Updates

Ruby On Rails List
Python list
Advanced Java
The JavaScript List
Apache Users
Full Disclosure
Linux Security

Search the archives!


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • From: javascript@xxxxxxxxxx (javascript@xxxxxxxxxx)
  • Subject: [Javascript] I don't know what to put down as the subject for this one...heh...
  • Date: Mon, 29 Jul 2002 04:40:17 EDT

--part1_18b.b7661d2.2a765971_boundary
Content-Type: text/plain; charset="US-ASCII"
Content-Transfer-Encoding: 7bit

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

--part1_18b.b7661d2.2a765971_boundary
Content-Type: text/html; charset="US-ASCII"
Content-Transfer-Encoding: 7bit

<HTML><FONT FACE=arial,helvetica><FONT  SIZE=2 FAMILY="SANSSERIF" FACE="Arial" LANG="0">I am creating a user-defined-number -&gt; (x) of input text boxes on the fly.<BR>
giving them each the name service(1 - x)<BR>
example:<BR>
</FONT><FONT  COLOR="#0000ff" style="BACKGROUND-COLOR: #ffffff" SIZE=2 FAMILY="SANSSERIF" FACE="Arial" LANG="0">name=service1<BR>
name=service2<BR>
name=service3<BR>
</FONT><FONT  COLOR="#000000" style="BACKGROUND-COLOR: #ffffff" SIZE=2 FAMILY="SANSSERIF" FACE="Arial" LANG="0">...<BR>
</FONT><FONT  COLOR="#0000ff" style="BACKGROUND-COLOR: #ffffff" SIZE=2 FAMILY="SANSSERIF" FACE="Arial" LANG="0">name=servicex<BR>
</FONT><FONT  COLOR="#000000" style="BACKGROUND-COLOR: #ffffff" SIZE=2 FAMILY="SANSSERIF" FACE="Arial" LANG="0"><BR>
I want to write to these boxes using the following for loop:<BR>
<BR>
</FONT><FONT  COLOR="#ff0000" style="BACKGROUND-COLOR: #ffffff" SIZE=2 FAMILY="SANSSERIF" FACE="Arial" LANG="0">for (i = 1; i &lt;= x; i++)<BR>
{<BR>
&nbsp; document.mainForm.service+i+.value = "myValue";<BR>
}<BR>
</FONT><FONT  COLOR="#000000" style="BACKGROUND-COLOR: #ffffff" SIZE=2 FAMILY="SANSSERIF" FACE="Arial" LANG="0"><BR>
...obviously that doesn't work, so i tried this:<BR>
<BR>
</FONT><FONT  COLOR="#ff0000" style="BACKGROUND-COLOR: #ffffff" SIZE=2 FAMILY="SANSSERIF" FACE="Arial" LANG="0">for (i = 1; i &lt;= x; i++)<BR>
{<BR>
&nbsp; temp = "document.mainForm.service"+i+".value<BR>
&nbsp; temp = "myValue";<BR>
}<BR>
</FONT><FONT  COLOR="#000000" style="BACKGROUND-COLOR: #ffffff" SIZE=2 FAMILY="SANSSERIF" FACE="Arial" LANG="0"><BR>
that didn't work either.&nbsp; I wanted to avoid using ID's but it looks like I have to, unless any of you can point me in another direction.<BR>
<BR>
<BR>
Thank you for your time,<BR>
Scott</FONT></HTML>

--part1_18b.b7661d2.2a765971_boundary--