...

View Full Version : Added Sharethis Javascript to page now my own voting button doesn't work



instaunt
05-18-2012, 07:54 PM
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

Philip M
05-18-2012, 09:20 PM
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.

instaunt
05-18-2012, 10:10 PM
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.

instaunt
05-21-2012, 01:31 PM
Is there no way to automatically check for duplicate function names across two scripts?

Mike

Philip M
05-21-2012, 02:03 PM
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".



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum