SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Addict
    Join Date
    Dec 2001
    Location
    Vancouver, Canada
    Posts
    352
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    creating an external JavaScript file

    Hi,

    I have a client that is crating several pages with the same javascript codes in each of them.

    Is there a way to do exactly like CSS where you can create your codes in an external file and link all the web pages that need the javascript to this external file?

    If yes, how?

    thanks

    Sheriff

  2. #2
    SitePoint Guru dale_burrell's Avatar
    Join Date
    Aug 2002
    Location
    Wellington, New Zealand
    Posts
    861
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Code:
    <script type="text/javascript" language="JavaScript" src="my_js_file.js"></script>
    my_js_file.js has everything in it that would normally go between the script tags.
    If you aren't living life on the edge
    - you're taking up too much space
    Creative Dreaming Ltd / Ask The Local / Amanzi Travel

  3. #3
    SitePoint Addict
    Join Date
    Dec 2001
    Location
    Vancouver, Canada
    Posts
    352
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Tanks dale,

    One last question

    If it is like CSS, than the external page would be written with Notepad and we would not start the external page with the ususal <html> tags or even the <script> tags.

    I would just start writing my codes directly.

    Am I right?

    Sheriff

  4. #4
    SitePoint Guru dale_burrell's Avatar
    Join Date
    Aug 2002
    Location
    Wellington, New Zealand
    Posts
    861
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by SheriffG.Guirguis
    I would just start writing my codes directly.

    Am I right?
    Yes.
    If you aren't living life on the edge
    - you're taking up too much space
    Creative Dreaming Ltd / Ask The Local / Amanzi Travel


Bookmarks

Posting Permissions

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