calling java script from file vs. on page?

Discussion in 'JavaScript' started by axemedia, Nov 12, 2006.

  1. #1
    What is the proper syntax to be able to offload a java script to a separate file instead of it being embedded in the html code for a page.
     
    axemedia, Nov 12, 2006 IP
  2. SoKickIt

    SoKickIt Active Member

    Messages:
    305
    Likes Received:
    30
    Best Answers:
    0
    Trophy Points:
    70
    #2
    <script src="filename.js" type="text/javascript"></script>
    HTML:
     
    SoKickIt, Nov 12, 2006 IP
    axemedia likes this.
  3. axemedia

    axemedia Guest

    Messages:
    1,070
    Likes Received:
    79
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Now, inside that file do i still need the <script> </script> tags? Or do the tags in this line of code take care of that?
     
    axemedia, Nov 12, 2006 IP
  4. SoKickIt

    SoKickIt Active Member

    Messages:
    305
    Likes Received:
    30
    Best Answers:
    0
    Trophy Points:
    70
    #4
    Nope, you don't need them.
     
    SoKickIt, Nov 12, 2006 IP