I need to write a function that copies variables to fields. I've used an
array and loop because it's neater than writing a similar sentence out
10 times.
var myString = new
String("id,call ername,address, phone,phoneb,em ail,sqft,source ,action,status" );
var myFields = myString.split( ',');
//myValues is an array of values passed to the function
var myValues =
[id,callername,a ddress,phone,ph oneb,email,sqft ,source,action, status];
for(var i=0;i<myFields. length;i++) {
document.formna me.myFields[i].value=myValues[i];
}
Firefox returns 'document.edit. myFields' has no properties. IE doesnt
like it either. I'm sure this is a simple question but Google has turned
up nothing :(
array and loop because it's neater than writing a similar sentence out
10 times.
var myString = new
String("id,call ername,address, phone,phoneb,em ail,sqft,source ,action,status" );
var myFields = myString.split( ',');
//myValues is an array of values passed to the function
var myValues =
[id,callername,a ddress,phone,ph oneb,email,sqft ,source,action, status];
for(var i=0;i<myFields. length;i++) {
document.formna me.myFields[i].value=myValues[i];
}
Firefox returns 'document.edit. myFields' has no properties. IE doesnt
like it either. I'm sure this is a simple question but Google has turned
up nothing :(
Comment