Forum Moderators: open
Now, I have a page full of textboxes (var1, var2, var3,...) I want to use a loop to collect the values of these forms and store them in a single string. There are quite a few, so I didn't want to have a long list of individually referencing each one.
So, is there some way to dynamically choose which variable to access?
var d=document;
var f=your_forms_name;
var concatString="";
var separator="¦";
for(i=0;i<d.f.elements.length;i++){
if(d.f.elements[i].name.substring(0,2)=="var"){
elevalue= d.f.elements[i].value+"";
concatString=concatString+elevalue+separator;
}}