473,396 Members | 1,933 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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

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
Jul 23 '05 #1
4 1429
essayez :

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

alert (xx.value);
}
HelLind a écrit:
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


Jul 23 '05 #2
G Roydor <gu********@NOlaposteSPAM.net> wrote:
HelLind a écrit:
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.
essayez :

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

alert (xx.value);
}


a.b is equivalent to a["b"]

document.formupload["filename" + i]

Regards,
Steve
Jul 23 '05 #3
HelLind wrote:
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
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

Jul 23 '05 #4
it works, thanks all.
Jul 23 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: deko | last post by:
I have a file that contains the output of time(). A different time is on each line of the file, and each line represents a visit to the website. I want to calculate the total visits per day,...
4
by: nc | last post by:
My iterator can find my collection when my Action class calls my jsp directly, however when my Action class calls an html file that is set up with IFrames (one of which is loading that same jsp), I...
40
by: googler | last post by:
I'm trying to read from an input text file and print it out. I can do this by reading each character, but I want to implement it in a more efficient way. So I thought my program should read one...
4
by: rajarshi.guha | last post by:
Hi, I have an XML file which contains entries of the form: <idlist> <myID>1</myID> <myID>2</myID> ..... <myID>10000</myID> </idlist> Currently, I have written a SAX based handler that will...
3
by: ahammad | last post by:
Well, the title pretty much describes what I want to do. I want to be able to read the contents of a Word document (*.doc). I also want to be able to read it to a CString object, and then search that...
1
by: Steve | last post by:
Hello- I have numerous variables called varNameX (where X is equal to a number from 0 to a known number "n"). Using VB.NET, I would like to iterate through all of these variables to run...
3
by: Steve | last post by:
Hello- I have numerous variables called varNameX (where X is equal to a number from 0 to a known number "n"). Using VB.NET, I would like to iterate through all of these variables to run...
13
by: stef mientki | last post by:
hello, I generate dynamically a sequence of values, but this "sequence" could also have length 1 or even length 0. So I get some line in the form of: line = '(2,3,4)' line = '' line = '(2)'...
4
by: tushar.saxena | last post by:
Hi, I'm trying to read a file using the istearm class (I cant use ifstream since the input might be a file or it might be stdin). istream *input; // Add checks for file name here, else use...
32
by: Bill Cunningham | last post by:
I am interested in writing a numeric text reader. This only reads numbers of securities and stores them. Nice practice. I have determined that these functions are needed. isalpha, isdigit,...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.