Web Analytics Made Easy -
StatCounter Two javascripts on one page? - CodingForum

Announcement

Collapse
No announcement yet.

Two javascripts on one page?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Two javascripts on one page?

    Hi there,
    Could someone please help me - I am trying to put more than one javascript on one page and they just don't seem to like each other - only one works.
    Is there a special function I need to put it to enable them to work alongside each other?
    Thanks for any help

  • #2
    same function name?

    are you including any .js files? or placing the code in the .html file itself?

    as long as the function names are different then they should be ok.

    do both work separatly? I am wondering if one of the scripts is broken.

    In javascript if there is any problems in any of the scripts you can have the whole thing not work.

    -S. Bob

    Comment


    • #3
      You can have as many scripts as you want.

      Have a look at:-



      In short, the idea is

      onload=" dothis(); dothat(); dotheother;"

      that is, separating with semi-colons.

      All the code given in this post has been tested and is intended to address the question asked.
      Unless stated otherwise it is not just a demonstration.

      Comment


      • #4
        this info is inherent in the previous posts but i just thought it might help to stress it:
        if the two scripts don't have any naming conflicts, then making sure that in the header section, there's a semicolon at the end of the first script is often all it takes to make them both work.
        jf~ if you're not part of the solution, you're part of the precipitate.

        Comment


        • #5
          Thank you!

          Thanks all of you - I've taken all your comments in hand and I'm double checking functions, variables etc - and all the other fun stuff you all suggested!
          Thanks so much for your speedy and very helpful replies!

          Comment

          Working...
          X