Results 1 to 3 of 3

Thread: How can I include multiple javascript source files in my html file?

  1. #1
    Join Date
    Oct 2012

    How can I include multiple javascript source files in my html file?

    Iím new to javascript and Iíve learned that the (standard) way to include javascript from a file which is separate to your html file is like this:

    <script type="text/javascript" src="external.js"></script>

    But this means that all my javascript code must be contained in one single massive file.

    But itís easier to navigate and debug a small javascript file, i.e. easier to develop js code in multiple small .js files, instead of the single massive Ďexternal.jsí indicated above.

    So how can I include multiple files of javascript code?

    Do you need a tool like Aptana?


  2. #2
    Join Date
    Jan 2011
    If that is correct it would mean that all of your html code should reside in a single div or some other html element, which is not...
    you would include your modular reusable scripts in your documents like this:

    <script type="text/javascript" src="external1.js"></script>
    <script type="text/javascript" src="external2.js"></script>
    <script type="text/javascript" src="external3.js"></script>
    <script type="text/javascript" src="externalN.js"></script>

  3. #3
    Join Date
    Oct 2012
    Oh, it's that simple! (All the examples I had seen so far just showed the inclusion of a single file.)


Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center