Update2:
What I really wanted to ask was already discussed on another page. Please check the following entry.
(Thanks to BobS .)
How do I access a local area dynamically in javascript?
Hello.
I started using jQuery and am wondering how to dynamically call functions in an anonymous function from String. Say, for example, I have the following functions:
function foo() {
alert("foo");
}
jQuery(document).ready(function(){
function bar() {
alert("bar");
}
}
I tried to figure out what could be the analogue of a “window”, which can call functions from the global namespace, for example window [“foo”]. In the small example above, how can I call the function panel from the string "String"?
.
:
:
- , .
- , obj ['bar'].
- eval ( ), ( ).
- URI .
Javascript, , 'this' "" :
name = 'bar';
this[name];
(...).
. Javascript , .