View Full Version : Using A Variable Value to Declare A Variable?

02-08-2004, 04:19 AM
Say the variable menu contains the value "menu1" and I want to declare a variable called menu1_status. I want to do something like:

var eval(menu + "_status") = 1;

Except that doesn't work, even without the var part (with var it complains about syntax). Hopefully you understand what I'm trying to accomplish! Any suggestions are appreciated. Thanks in advance.

02-08-2004, 04:40 AM
window[menu+ '_status']=1;

02-08-2004, 04:53 AM
Wow, thank you, sir.