On Aug 28, 5:21 pm, Flyzone <flyz...@technologist.com> wrote:
> Hi, i have a little trouble with javascript putting data in a form
> html.
> I'm parsing an xml file with DomXML (into an hta file), in a loop:
>
> if (i==0) {
> document.form.moduleA_0.value = varnameA;
> document.form.moduleB_0.value = varnameB;
> ...
> else if (i==1) {
> document.form.moduleA_1.value = varnameA;
> document.form.moduleB_1.value = varnameB;
> ...
> else if (i==2) {
> document.form.moduleA_2.value = varnameA;
> document.form.moduleB_2.value = varnameB;
> ...
> And in the html form, many input field idetify by the name moduleA,
> moduleB.....
> That is very boring.
> There is a way to identify them in javascript as 'moduleA_'+i like an
> array,
Yes (though what you are dealing with is not an array even though you
can access it by index):
var form = document.form;
form['moduleA_' + i] = varnameA;
form['moduleB_' + i] = varnameB;
see :
<URL:
http://www.jibbering.com/faq/#FAQ4_39 >
--
Rob