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

How to use a variable as a part of an object

From: Stefan Mueller <seekware-remove-@yahoo.com>
Date: Wed Nov 30 2005 - 21:33:02 CET

To change the value of input boxes I use
  document.MyForm.MyInput1.value = "Test";
  document.MyForm.MyInput2.value = "Test";

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";

Stefan
Received on Sat Dec 3 04:33:56 2005