S
szimek
Hi!
In an app which I'm trying to fix to work with FF there's a lot of
code like eval("function_name();"). I remember that there's some way
to call global functions using window object, but I can't get it to
work. Here's what I tried (in Firebug console):
function a() {alert("a called")};
a(); // works
eval("a();"); // works
window["a"](); // doesn't work
TypeError: window.a is not a function
window.b = function() {alert("b called");}
window["b"](); // works
So how can I call global functions in other way than using eval?
Thanks in advance
In an app which I'm trying to fix to work with FF there's a lot of
code like eval("function_name();"). I remember that there's some way
to call global functions using window object, but I can't get it to
work. Here's what I tried (in Firebug console):
function a() {alert("a called")};
a(); // works
eval("a();"); // works
window["a"](); // doesn't work
TypeError: window.a is not a function
window.b = function() {alert("b called");}
window["b"](); // works
So how can I call global functions in other way than using eval?
Thanks in advance