jsrules
08-19-2005, 03:45 PM
I'm trying to pass a text string to a function then use that string to build a variable and assign an object to it.
This alerts the word undefined
function clearSelection(listName){
var form = document.appForm.listName;
alert(form);
}
clearSelection('webServer');
This alerts the text "document.appForm.webServer"
function clearSelection(listName){
var form = "document.appForm." + listName;
var obj = form;
alert(obj);
}
clearSelection('webServer');
If i call on the object correctly i would expect the word [object] to be alerted.
How can i pass a text string and attach it to an object call??
This alerts the word undefined
function clearSelection(listName){
var form = document.appForm.listName;
alert(form);
}
clearSelection('webServer');
This alerts the text "document.appForm.webServer"
function clearSelection(listName){
var form = "document.appForm." + listName;
var obj = form;
alert(obj);
}
clearSelection('webServer');
If i call on the object correctly i would expect the word [object] to be alerted.
How can i pass a text string and attach it to an object call??