tags:

views:

25

answers:

1

Hi folks i am a beginer to Java script so appologies if this is a dumb question. I am trying to put the following in a for loop but I can't seem to get it to work.

if (rowID==1) { document.form1.class_titleDis_1.value=class_title; } if (rowID==2) { document.form1.class_titleDis_2.value=class_title;

}

This is what I tried

var i=1;
for (i=1;i<=2;i++)
{
  document.form1.(class_titleDis_)+i.value=class_title;
}

I would be really grateful for any suggestions. Graham

A: 
document.form1.(class_titleDis_)+i.value=class_title;

Should likely be:

document.form1['class_titleDis_'+i].value=class_title;
unomi
You are an absoulte star, worked perfectly! You would not believe how many permutations of this I had tried. So many many thanks. Graham
Graham