That's exactly the point.
You can't access the variable like that in javascript. But now, thanks to a link indicated by Tom (although he wanted to show me something else in the same page) I've found out the answer. In your example, to access the input box we should do:
document.form1['string[$i]'].value
instead of
document.form1.string[$i].value
I haven't tested it yet, but it appears to be right.
Thanks for your help,
Zirbes