using a variable in a JS dot notation string
| From: | Herhuth, Ron | Date: | Tue, 27 Jan 2004 14:26:41 +0000 |
| Subject: | using a variable in a JS dot notation string | ||
| Groups: | php.windows | ||
| Request: | Send a blank email to php-windows+get-22668@lists.php.net to get a copy of this message | ||
I have a Javascript function in my PHP page that I need to plug a variable
into, and for the life of me I can't figure out how to do it.
This is the hardcoded version that works:
rBvalue = document.voteForm.Test_Amendment_One[0].checked
In the above example the "Test_Amendment_One" is the value I would like to
pass in a varaible:
$tempVar = "Test_Amendment_One"
rBvalue = document.voteForm.($tempVar)[0].checked
Obviously that doesn't work...what syntax should I use to correctly make
this work?
Thanks,
Ron