I have a form with many text fields that are created from another program (java)
<input type=text name = 'myname1'>
<input type=text name = 'myname2'>
<input type=text name = 'myname3'>
.
.
.
.
.
and I have a javascript that loops through these text fields
for (var x = 1; x <= numberoftextfields; x++)
{
document.FormName.myname+x+.value = 'Test';
}
This javascript does not work.
Can somebody assist me on this.
Hi guys,
document.FormName.myname+x+.value = 'Test';
The reason your code didn't work is that you were trying to construct the element variable as if it were a string... If you wanted to to it like this, you would need to construct the javascript you wanted to execute as a string and then execute it in an eval function...
The previous ones are perfect because I have other input textboxes with names like myusname, mypassword, and so on.
So I only wanted textboxes with myname1, myneme2.......
No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.