Re: How to use a variable as a part of an object
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.javascript archive

Re: How to use a variable as a part of an object

From: VK <schools_ring@yahoo.com>
Date: Wed Nov 30 2005 - 21:45:01 CET

Stefan Mueller wrote:
> Is it also possible to use a variable instead of MyInput1 and MyInput2?
> I'm thinking about something like
> var MyVariable = "MyInput1";
> document.MyForm.MyVariable.value = "Test";

document.forms["MyForm"].elements[MyVariable].value = "Test";
// MyVariable goes without quotes of course
Received on Sat Dec 3 04:33:59 2005