Re: using a variable in a JS dot notation string
| From: | DvDmanDT | Date: | Tue, 27 Jan 2004 17:06:48 +0000 |
| Subject: | Re: using a variable in a JS dot notation string | ||
| References: | 1 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-22671@lists.php.net to get a copy of this message | ||
echo "document.voteForm.{$tempVar}[0].checked";
echo 'document.voteForm.'.$tempVar.'[0].checked';
--
// DvDmanDT
MSN: dvdmandt¤hotmail.com
Mail: dvdmandt¤telia.com
"Ron Herhuth" <Ron.Herhuth@tatumpartners.com> skrev i meddelandet
news:cf6101c3e4e1$94f95a90$f25d2981@tatumlink.com...
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