sslrgrt
02-23-2003, 11:32 PM
I'm trying to change the class of a table cell using JavaScript with the onClick event of another cell.
If I use the cell ID (tab1) in the statment:
tab1.className="tabmenuoff";
it works.
But if I assign the cell ID value to a variable and use that as the object ID in the statement:
var tabname="tab1";
tabname.className="tabmenuoff";
it doesn't. But I get no errors
I need to use a variable because I need to change a number of cells and use the 'for' loop to accomplish this using the numeric value on the end of the object name.
I'm sure the answer is very simple but I'm new to this - can anyone help!!!!
If I use the cell ID (tab1) in the statment:
tab1.className="tabmenuoff";
it works.
But if I assign the cell ID value to a variable and use that as the object ID in the statement:
var tabname="tab1";
tabname.className="tabmenuoff";
it doesn't. But I get no errors
I need to use a variable because I need to change a number of cells and use the 'for' loop to accomplish this using the numeric value on the end of the object name.
I'm sure the answer is very simple but I'm new to this - can anyone help!!!!