How to update document object value in loop (Javascript)
Posted
by Graham
on Stack Overflow
See other posts from Stack Overflow
or by Graham
Published on 2010-06-10T17:44:00Z
Indexed on
2010/06/10
18:22 UTC
Read the original article
Hit count: 352
javascript-execution
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
© Stack Overflow or respective owner