JavaScript Includes

Discussion in 'Mac Programming' started by satans_banjo, Jan 1, 2007.

  1. macrumors regular

    #1
    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
     
  2. macrumors regular

    #2
    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).
     

Share This Page