how to include javascript libraries in my own script

This question already has an answer here:

  • How do I include a JavaScript file in another JavaScript file? 51 answers

  • There are a lot of tools around though they seem overkill for what you have to do.

    I think your best bet would be to take those files and copy paste them into one single file.

    If you want to use a tool, since you require it (and its complexity :D) then I would recommend trying out grunt, it is easy to set up and if you'll ever need to expand it to suit further needs it will be almost hassle free, for example, to concatenate:

    grunt.initConfig({
      concat: {
        dist: {
          src: ['libs/first.js', 'libs/second.js'],
          dest: 'out/first-and-second.js'
        }
      }
    });
    

    There are multiple tools that do what you want:

    http://requirejs.org/

    https://developers.google.com/closure/compiler/


    用下一行为每个js写一个函数:

    document.write('<script type="text/javascript" src="JS/jquery-1.9.1.min.js"></script>');
    
    链接地址: http://www.djcxy.com/p/42490.html

    上一篇: 我如何引用加载当前的脚本标记

    下一篇: 如何在自己的脚本中包含JavaScript库