Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Aug 2006
    Location
    Illinois
    Posts
    68
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Best Way to Reference JavaScript Code?

    What is the best way to reference JavaScript code, inline or external?

    Normally we reference scripts in one external JS file, but in this case we have 6 different HTML files with 6 associated JS functions. Currently we are referencing all 6 functions in one external file. We were wanting to move each function within each HTML file, but we didn't know if it was best to have the script inline or in individual external script files.

    Thoughts, opinions?
    Sarah

  • #2
    Regular Coder
    Join Date
    May 2005
    Location
    Michigan, USA
    Posts
    566
    Thanks
    0
    Thanked 0 Times in 0 Posts
    You do it external so that the browsers can cache the page and js file independently of each other.
    Note: I do not test code. I just write it off the top of my head. There might be bugs in it! But if any thing I gave you the overall theory of what you need to accomplish. Also there are plenty of other ways to accomplish this same thing. I just gave one example of it. Other ways might be faster and more efficient.


  •  

    Posting Permissions

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