Possible duplicate:
if function does not exist write function - javascript
I have a situation where some function X is called. After some postbacks, this function is no longer declared, but still called by the code, obviously, I get a js error saying X is not defined . (call it a mistake if you want), but Do not call, not under my control, but change the functionality of the call.
What I would like to do is fault tolerance, which will declare such a function if it does not exist. So the logic is this:
If the function is not declared, declare it.
Is it possible in javascript to declare / register a function dynamically in a global scope?
Thanks.
source share