Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

satans_banjo

macrumors regular
Original poster
Sep 12, 2005
218
0
SE London
Hi

Here's the deal: I've got all of my functions etc. on an external JavaScript file. However, this file also needs to reference a library (script.aculo.us for those interested) but I can't find any way to do this in JavaScript. As far as I can see it doesn't have an include/import function built-in

Thanks

Ben
 
Hi

Here's the deal: I've got all of my functions etc. on an external JavaScript file. However, this file also needs to reference a library (script.aculo.us for those interested) but I can't find any way to do this in JavaScript. As far as I can see it doesn't have an include/import function built-in

Thanks

Ben

Here is my understanding:

JavaScript does not do an "import" feature. The import you are using is actually HTML, and your browser does it for you. I believe what you need to do it just have two statements in your HTML, one to pull in the libs you want, the other to pull in your custom libs. The browser puts these methods into what would be considered a "Global" scope, so calling a method in from your code to the lib code would just work. Consider it PFM (Pure Effin Magic).
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.