How to put 2 javascripts in a html page

Discussion in 'JavaScript' started by apeee, Oct 30, 2006.

  1. #1
    I need to put 2 javascripts in one html page. Since they are tooooo big I want to keep them in js file.

    <head>
    <script type="text/javascript" src="/jquery1.js"></script>
    <script type="text/javascript" src="/jquery2.js"></script>
    </head>

    But when I keep the above code in html file, only one of the javascript seems to work.

    And, when I keep both the javascript source in the html tag they work fine but keeping them in separate two files as jquery1.js and jquery2.js (as above) only one of them seems to work. Please help me, what should I do?
     
    apeee, Oct 30, 2006 IP
  2. datropics

    datropics Peon

    Messages:
    309
    Likes Received:
    3
    Best Answers:
    1
    Trophy Points:
    0
    #2
    why two separate files?
     
    datropics, Oct 30, 2006 IP
  3. PayItForward

    PayItForward Peon

    Messages:
    752
    Likes Received:
    43
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Hmm, it should work just fine. You can test it by removing/checking each of them. You can also try including just jquery1 then have an include statement in jquery1 that includes jquery2.
     
    PayItForward, Oct 30, 2006 IP
  4. apeee

    apeee Active Member

    Messages:
    158
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    60
    #4
    thanks for your post....but i'm confused what you said..... can I add two javascripts code in the same file??

    i really don't know anything about javascripts......
     
    apeee, Oct 30, 2006 IP
  5. datropics

    datropics Peon

    Messages:
    309
    Likes Received:
    3
    Best Answers:
    1
    Trophy Points:
    0
    #5
    yup - as long as global variable names are unique and function names are unique
     
    datropics, Oct 30, 2006 IP