PDA

View Full Version : JavaScript Includes




satans_banjo
Jan 1, 2007, 02:24 PM
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



mbabauer
Jan 3, 2007, 02:56 PM
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).