Wrox Home  
Search P2P Archive for: Go

  Return to Index  

javascript thread: Is there a way to get a reference to an object when you supply the name of the object.


Message #1 by "Michael Bunger" <michael@r...> on Thu, 19 Apr 2001 14:32:54 -0500
Hi,

I'm relatively new to Javascript, so this may be a very elementary question.

What I need to do is get a reference to a text box, but the name of the text
box is not known until the code is run -- in other words, it is based off of
the initiating control.  For example, if the initiating control is named
"rptBuilderOptionFloorPlans:ctrl2:txtDepositPercent", then I want to be able
to create a reference to
"rptBuilderOptionFloorPlans:ctrl2:txtDepositDollars" and then modify its
value and maybe other things.  Note that these control names are real
control names -- they are generated by ASP.NET while using the repeater
control.  The reason I must be able to create an object reference on the fly
is because the names of the controls will vary depending on how many are
generated. For example, on one iteration of the code, there may be a
rptBuilderOptionFloorPlans:ctrl9:txtDepositDollars and
rptBuilderOptionFloorPlans:ctrl9:txtDepositPercent, but maybe for the next
user there will not be.

Any suggestions on how to get a reference to an object based on the name
will be greatly appreciated.

Thanks,
Michael Bunger


  Return to Index