Possible Duplicate:
if function does not exist write function – javascript
I have a situation when some function X is being called. After some postbacks this function is no longer declared, but still being called by the code, obviously i get js error saying X is not defined . (call it a bug if you wish) but
It is not under my control to not call it or to change the calling functionality.
What I would like to do is a fail safe that will declare such function if it does not exist. So the logic is:
If function not declared then declare one.
Is that possible in javascript i.e. to declare/register a function dynamically in global scope?
Thanks.
1 Answer