Can a variable be dynamic

I am using the var call in a button like this:

var menuPage = menuTxt

I then have other buttons that have a command like this:

1st button
menuPage = “m1”

2nd button
menuPage = “m2”

The result right now is if I select the button with menuPage = “m1” the var call still equals:

var menuPage = menuTxt

I would like it if it would equal

var m1 = menuTxt

Can this be done?

May I take a look at your code? You’re surely creating two different variables. :-\

Sure you can, here you go.:slight_smile:

:stuck_out_tongue:

I’m kind of lost here… can you attach the TXT file(s) too? :-\

Ok, let me explain a little. I am using cgi to right to a text file; this text file is what you would see in side of the text box. The part I am asking about has to do with sending a variable to cgi like “m1”. I want the “var” to be dynamic. Inside of the 1st two menu buttons you will see menuPage = “m1” and menuPage = “m2”. When I click on the soups button the variable menuPage = m2. So when I click on the save work button the code that goes


var menuPage = menu_txt1;

really should read


var m2 = menu_txt1;

because menuPage equals m2.

I kind of see what my own problem is, there is a difference between the variable:
number = 1
vs
var number = 1
I am trying to make the variable “number” = two different things at once. I am hoping there is a way around this.

Hope this sheds some light.

Oh! Ok. I think I got it. :sigh:

Assuming that menuPage equals “m1”:
[AS]var menuPage = “m1”;[/AS]
To read the actual variable, m1, you’d use:
[AS]this[menuPage];[/AS]
http://www.kirupaforum.com/forums/showthread.php?s=&threadid=12082

…I think I’ll shoot myself if I’m right, that was so easy. :stuck_out_tongue:

All good here, thank you very much for your time kode. So it looks like you can call a variable 3 ways:

number =1
var number = 1
this.number = 1

Any thoughts on the major differences of these variable callls.

(-::slight_smile: