Hi Julian,
Try this modification. It should work with an eval.
for (x = 0; x < numberOfProjects; x++)
{
var sProject;
sProject = "document.getElementById(\"project" + x + "\")";
project[x] = eval( sProject ).value;
}
thank you
Boni Gopalan
----- Original Message -----
From: "Julian Sinclair" <julian.sinclair@t...>
To: "javascript" <javascript@p...>
Sent: Wednesday, January 09, 2002 7:08 AM
Subject: [javascript] Build string to reference objects
> All,
>
> I am sure I have done something similar to this before but am having
problems today.
>
> I have a function which loops through a variable length loop and should
get the value from a number of text boxes depending on the
> size of the loop and puts them in an array. The portion I am having
trouble with is here is as posted here:-
>
> for (x = 0; x < numberOfProjects; x++)
> {
> var sProject;
> sProject = "document.getElementById(\"project" + x + "\")";
> project[x] = sProject.value;
> }
>
> What doesn't work though is the string sProject sets the correct string
but when I try to assign to the array using sProject.value
> all I get is "undefined".
>
> Where am I going wrong ?
>
> Julian
>
>
$subst('Email.Unsub').
>