Don Lancaster said:
>
I am trying to change a group of background colors by calculating their
names in a loop . Names are cfh13, cfh15, cfh17, etc...
Unlooped code like
cfh17.bgColor="#CCFFFF" ;
works just fine.
Code that does NOT involve a background color change but is calculated
within a loop works just fine, such as...
form[curedg + "s"]["value"] = "zorch" ;
But this does not....
form["cfh" + 17]["bg.Color"] = "#CCFFFF" ;
What am I doing wrong and how can I loop changing a named group of
background colors?
Your examples of what works and what doesn't should be more
similar, in order to help to determine where the problem lies.
There is no attribute named "bg.Color". If that was just a typo
in your post, and doesn't appear in your code, then you need to
learn to copy from your code and paste into your posts to avoid
wasting everybody's time.
Assuming that this also works:
form["cfh17"]["bgColor"] = "#CCFFFF" ;
then this should work:
form["cfh" + 17].bgColor = "#CCFFFF" ;
If the first case doesn't work, then the problem may be that
cfh17 isn't a form element, so you can't access it via the
form collection.
--