Page is a not externally linkable
- Code, Content, and Presentation
-- JavaScript and AJAX
---- calling & defining functions using funcName() vs. window['funcName']()


daveVk - 3:14 am on Jan 6, 2013 (gmt 0)


Define test outside of other functions (global scope) and you can call it from anywhere with window["test"] or other notations.

If as in these examples test is defined within another function (local scope) it will not work unless you explicitly give it global scope.
window["test"] = function(){...};

If you wish to keep it local and call with [] notation
var dog = {};
dog["test"] = function(){...};

and call as
dog["test"];


Thread source:: http://www.webmasterworld.com/javascript/4533285.htm
Brought to you by WebmasterWorld: http://www.webmasterworld.com