How to update document object value in loop (Javascript)
- by Graham
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