Help!Help! How to concatenate ...

F

Fed21

Any experts out there can help to solve the following problem:

I have the following Javascript expressions:

temp[0] = document.frmScr1.txtABC
temp[1] = document.frmScr1.txtDEF
temp[2] = document.frmScr1.txtHIJ

And I have created an array to store these values:
ary["ABC","DEF","HIJ"];

Now, the problem is that is it possible to generate a FOR loop to
perform the function as above?
e.g.
for (count=0; count < 3; count++) {
temp[count] = document.frmScr1.txt + ary[count]; // incorrect, guess
only
};

Of course the above code is incorrect, but what should I do or any
suggestion?

Many thanks in advance.
Fed.
 
C

Cycloneous Echevarria

Fed.,

You have to expose the value property in the
document.frmScr1.txtOBJECTNAME objects

var temp = new Array();
var ary["ABC","DEF","HIJ"];

temp[0] = document.frmScr1.txtABC.value;
temp[1] = document.frmScr1.txtDEF.value;
temp[2] = document.frmScr1.txtHIJ.value;

for (count=0; count < 3; count++) {
temp[count] = temp[count] + ary[count];
}
 

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

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top