[Project_owners] Javascript help

Konstantin Svist fry.kun at gmail.com
Thu Mar 2 17:03:34 EST 2006

one way is to include both files, in correct order, from container (like 
an HTML file). The trick is, both files appear in global scope, so 2nd 
one should see the defs of the 1st one (but not the other way around)

<script type="text/javascript" src="a.js"> <!-- defines foxyproxy -->
<script type="text/javascript" src="b.js"> <!-- uses foxyproxy -->

the other way is to use XmlHttpRequest to retrieve source of a.js while 
running b.js (and then eval source of a.js). Of course, usual caveats 
with using eval apply.


Eric H. Jung wrote:
> Hi,
> In file a.js, I define:
>   var foxyproxy = {...};
> In file b.js, I'd like to define:
>   foxyproxy.foo = function() { ... };
> but this yields a "foxyproxy is not defined" error in b.js. Is there anyway to do this in separate
> files?
> Thanks,
> Eric Jung
> _______________________________________________
> Project_owners mailing list
> Project_owners at mozdev.org
> http://mozdev.org/mailman/listinfo/project_owners

More information about the Project_owners mailing list