How to Iterate reading numerous file-field forms ???

H

HelLind

I have more than one File field forms named filename0, filename1,
filename2, and so on.....

And then I use javascript to read the value:

document.formupload.filename0.value
document.formupload.filename1.value

But I want to iterate it in a FOR loop, to save long codes.

for (i = 0; i < 9; i++) {
document.formupload.filename(???).value
}

How do I use JS to solve the above problem, to replace the (???), to
read the values of all the forms.

This surely have been answered before, but I don't know what keywords
to google for.

So anyone can help will be appreciated. TIA

roger
 
G

G Roydor

essayez :

for (i=....) {
var xx=document.formupload.filename + i;

alert (xx.value);
}
HelLind a écrit:
 
M

Mick White

HelLind said:
I have more than one File field forms named filename0, filename1,
filename2, and so on.....

And then I use javascript to read the value:

document.formupload.filename0.value
document.formupload.filename1.value

But I want to iterate it in a FOR loop, to save long codes.

for (i = 0; i < 9; i++) {
document.formupload.filename(???).value
}
var f=9
while(f--){document.formupload["filename+i].value}
Mick
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,682
Members
48,796
Latest member
Greg L.

Latest Threads

Top