When using objects... (easy question)

Say I have two javascript external sources. Is it possible for me to call one’s functions from the other? Do I need to use JS’s form of include within the other or can i just say “one.function()”?

functions are ‘global’ in scope, so as long as the function has been loaded you can call it from anywhere. The trick is you have to load them in the order you run them…

So for example, if you had in “test.js” a “function test()”, and in “doit.js” tried to call test(), if you included test.js in your HTML before doit.js, you reverse them, it would fail…

Unless of course the routine that calls test() is not called until after both scripts have been loaded into memory.

That’s the key – javascript assigns it’s namespace while loading, but doesn’t resolve dependency until you actually RUN the scripts… if your calls are all nice and neatly wrapped in functions and you initiate them manually – or you wait for “onload” before running any scripting – you can cross-call between internal scripting and multiple external scripts until you’re blue in the face.

Basically, it’s not an easy question to answer as it all hinges on the ORDER you do things in.