Trinithis
09-17-2007, 09:05 PM
Is there any way to add to a non-global, non-current scope in Javascript from the current scope?
I want to do something to the effects of:
function a() {
b();
c();
}
function b() {
b.caller.c = function() {
alert("c made from b");
};
}
a();
This doesn't work. Is what I'm trying to accomplish strictly impossible? (Feasibility is not an issue.)
I'm trying to make an Import script that imports code into the scope that called Import(). If I defined Import to return a string, I could do eval(Import("script.js")), but I want to make it so you only have to manually call one function.
I want to do something to the effects of:
function a() {
b();
c();
}
function b() {
b.caller.c = function() {
alert("c made from b");
};
}
a();
This doesn't work. Is what I'm trying to accomplish strictly impossible? (Feasibility is not an issue.)
I'm trying to make an Import script that imports code into the scope that called Import(). If I defined Import to return a string, I could do eval(Import("script.js")), but I want to make it so you only have to manually call one function.