global js variables?
Howdy y'all... first timer (posting) here, and probably with a dumb question, here goes...
Is there any way to show the user all the global javascript variables that are available?
In other words, say I have a web page with a simple script (in the html head):
<script>
var aaaa = 2;
var bbbb = "mytest";
var reallyLongNamedVariable1 = "hi";
</script>
Is there a way to access the names of those variables, perhaps through the window object?
The purpose of this is debugging... I have an input textbox and a button, and when the user clicks the button, it "evaluates" the contents of the textbox using "window[document.forms[0].txt[0].value]" .
So if the user enters "aaaa" and presses the button, it tells them that the value of aaaa is 2.
But if they don't know the case-sensitive name and spelling of the variable, or perhaps didn't even know it existed, I want to give them a list of all the variables. Is this possible? Does it make sense?
Is there any way to show the user all the global javascript variables that are available?
In other words, say I have a web page with a simple script (in the html head):
<script>
var aaaa = 2;
var bbbb = "mytest";
var reallyLongNamedVariable1 = "hi";
</script>
Is there a way to access the names of those variables, perhaps through the window object?
The purpose of this is debugging... I have an input textbox and a button, and when the user clicks the button, it "evaluates" the contents of the textbox using "window[document.forms[0].txt[0].value]"
So if the user enters "aaaa" and presses the button, it tells them that the value of aaaa is 2.
But if they don't know the case-sensitive name and spelling of the variable, or perhaps didn't even know it existed, I want to give them a list of all the variables. Is this possible? Does it make sense?
