Click to See Complete Forum and Search --> : Use a name of object in String to access that Object
kb244
Oct 12th, 2000, 10:18 AM
I have an array , the 3rd item is the name of an object on a page for example like "3_2|Check" how do I access that checkbox by a name I have in a string, so that I Can enable/disable it. This kind of thing has always fustrated me, no matter what language it is in, the reason its in a string to start with is because I created the JS array through ASP.
S@NSIS
Oct 26th, 2000, 01:14 PM
Hi,
If the array is in JavaScript then you can use it's eval function (which, as you quite rightly pointed out, is sadly missed in most other languages.)
example:
<SCRIPT Language = "JavaScript">
var StrString = "Checkbox1";
var MyObject = eval("document.all.form." + StrString);
MyObject.checked = true;
</SCRIPT>
Hope this helps
Shaun
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.