Hi all
Here’s a really simple question that I can’t believe has be stumped - lol
I need to reference a form element using two variable names to represent the actual form element names and the syntax of that request is driving me insane. Imagine we have a form called “theform” which has a select list called “cities” and the 3rd option is “New York”. If I have stored the index number of “New York” (2) in a variable called “lookingat”, and the name of the select box “Cities” in another variable called “lookingwhere”, then what would the request syntax be?
document.theform.lookingwhere.options[lookingat].selected = true;
The problem is the lookingwhere inclusion in this statement, it automatically tries to find a form element called “lookingwhere” cause the syntax is wrong. I’ve tried surrounding it with brackets, quotes, using an eval and then splitting the reuest etc but to no avail.
I am sure its a REALLY simple matter of an extra dot or comma etc. PLEASE HELP.