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 5 of 5
  1. #1
    Regular Coder
    Join Date
    Apr 2010
    Posts
    120
    Thanks
    6
    Thanked 0 Times in 0 Posts

    Added Sharethis Javascript to page now my own voting button doesn't work

    Voting button on the poll in the left column works fine if you take the sharethis javascripts out. Why won't they work together though?

    <script type="text/javascript" src="http://www.claimsheaven.co.uk/polls/admin/script.js"></script>
    <script type="text/javascript">var switchTo5x=true;</script>
    <script type="text/javascript" src="http://w.sharethis.com/button/buttons.js"></script>
    <script type="text/javascript" src="http://s.sharethis.com/loader.js"></script>

    e.g. on this page:

    http://www.claimsheaven.co.uk/news/20120305.php

  • #2
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    18,079
    Thanks
    203
    Thanked 2,542 Times in 2,520 Posts
    There are two reasons why multiple scripts in the same page will not work together.

    a) duplicate global variable and/or function names (including loop counters etc.)
    b) multiple onload statements.

    All advice is supplied packaged by intellectual weight, and not by volume. Contents may settle slightly in transit.

    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.

  • #3
    Regular Coder
    Join Date
    Apr 2010
    Posts
    120
    Thanks
    6
    Thanked 0 Times in 0 Posts
    But how do I found out what's conflicting? I downloaded firebug, but I can't seem to work it. I thought it would tell me if there are duplicate function names but I can't see it.

    There is too much code to go through manually effectively.

  • #4
    Regular Coder
    Join Date
    Apr 2010
    Posts
    120
    Thanks
    6
    Thanked 0 Times in 0 Posts
    Is there no way to automatically check for duplicate function names across two scripts?

    Mike

  • #5
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    18,079
    Thanks
    203
    Thanked 2,542 Times in 2,520 Posts
    Quote Originally Posted by instaunt View Post
    Is there no way to automatically check for duplicate function names across two scripts?

    Mike
    Nope. Not that I am aware of.

    You might try combining the two files into one text file, and then use the "find" feature of a text editor to search for the name of each function in turn, which would probably expose duplicates. Duplicate global variables may be harder, especially if the have short names such as "a".

    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.


  •  

    Posting Permissions

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