Re: dynamic javascript loop
by "Srinivasan Ramakrishnan" <srinivar(at)md3.vsnl.net.in>
|
Date: |
Sun, 8 Oct 2000 03:39:59 +0530 |
To: |
<rob(at)tconsult.com>, <hwg-languages(at)hwg.org> |
References: |
tconsult |
|
todo: View
Thread,
Original
|
|
You are mixing up your strings and objects
It should be if necessary::
eval("document.frm." + model + ".options[" + ct+ "] = new
Option(selectArray[" + ct + "])")
-Srini
----- Original Message -----
From: Rob Taylor <rob(at)tconsult.com>
To: <hwg-languages(at)hwg.org>
Sent: Sunday, October 08, 2000 3:00 AM
Subject: dynamic javascript loop
> Please see the code below. I have forms named like this
>
> document.frm.model1
> document.frm.model2
> document.frm.model3
> etc....
>
> I need to loop through these forms with javascript.
> I can create the string which is the form call
> but I can not get javascript to recognize it as the
> form call. For example I can loop through and create
> document.frm.model1.options[0]
> but I can not get javascript to recognize it as a
> form call so I can set a value to it.
>
> I have tried eval. If you can help, I would appreciate it.
>
> for (ct = 0; ct < selectArray.length; ct++)
> {
> model = 'model' + rowCount
> document.frm. + model + .options[ct] = new Option(selectArray[ct])
> }
>
>
> Thanks,
>
>
> Rob
>
HWG: hwg-languages mailing list archives,
maintained by Webmasters @ IWA