Results 1 to 4 of 4
  1. #1

    very basic question...

    when they say "an external" java script file (.js) does that mean that the file is in your web folder...not embeded on the page?
    I have the actual text for the java script I need but I need to save it as a ".js" file and simply cannot figure out how to do that.


  2. #2
    Yep, an external javascript file is indeed one that is saved as a separate file. The main reason for doing this would be where you would be using the same piece of javascript over and over.

    You could save your file anywhere really, as long as you link to it correctly. The most common options would be in the same directory as your page, or, if you were going to use it in a number of pages, in another folder, i.e., one labelled "scripts:.

    To link to it, you need to put the following code in the Head of your page:

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

    You can use either a relative or absolute link:

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


    <script src="" type="text/javascript"></script>

    Also, when you say you don't know how to save the file ... I'm not sure if this is what you mean, but just write your script in your editor (notepad, dreamweaver, etc.), then choose Save As ... and save it with a .js file extenstion.

  3. #3
    You would also save brandwidth, since the file is Cached by the browser. Same goes for External CSS files, when they are used on multiple pages.

  4. #4
    And when it is a single page, or a script designed for a unique page, you suffer from the http overheads, eventually lose your bandwidth

    best regards;
    - kunter ilalan web designer
    follow him on twitter and on MediaCollege


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Subscribe to us on YouTube