More than 1 javascript on page

Discussion in 'HTML & Website Design' started by nadalbg, Apr 15, 2009.

  1. #1
    I have this problem, when I put more than 1 javascript only the 1st works. I searched google and found the problem this http://www.javascriptkit.com/javatutors/multiplejava.shtml

    But I dont understand what I should do, I just want to add 2 javascripts that are for advertisements, but as I said I cant make work more than 1.
    Anyone can explain me ?
     
    nadalbg, Apr 15, 2009 IP
  2. Kunalbhatia

    Kunalbhatia Active Member

    Messages:
    296
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    60
    #2
    The problem you are facing is that both the scripts are trying to run at the same time. That is to say, the first one works, but when the second one is executed, it conflicts with the first one already running and hence does not execute. You need to basically integrate both the scripts into one script to run at once.

    How that is to be done, depends on the situation and the coding.

    Regards

    Alex
     
    Kunalbhatia, Apr 15, 2009 IP
  3. designgenerator

    designgenerator Guest

    Messages:
    118
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    agree, try running one after another.
     
    designgenerator, Apr 15, 2009 IP
  4. nadalbg

    nadalbg Well-Known Member

    Messages:
    377
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    138
    #4
    How do I do that, I am not good at it at all.
     
    nadalbg, Apr 16, 2009 IP
  5. Mockup-Markup

    Mockup-Markup Peon

    Messages:
    32
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Set up your scripts in the <head> tab.

    <script type="text/javascript" src="script1.js"></script>
    <script type="text/javascript" src="script2.js"></script>
    <script type="text/javascript" src="script3.js"></script>
    <script type="text/javascript" src="script4.js"></script>
    <script type="text/javascript">
    //Run Code Here
    </script>
     
    Mockup-Markup, Apr 20, 2009 IP
  6. nadalbg

    nadalbg Well-Known Member

    Messages:
    377
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    138
    #6
    What should I write in //Run Code Here ?
     
    nadalbg, Apr 20, 2009 IP