PDA

View Full Version : One javaScript stops another from working please help!



gmnightingale
Nov 30th, 2009, 01:35 PM
My website is all up and running and I decided to put a new image viewing script on, I already had a revolving image script showing all my previous work before but the latest script has totally stopped the previous from working. You can view what I mean at www.actioncomputing.co.uk

I am using 2 scripts both available on Dynamic Drive they are


Lightbox image viewer 2.03a

Ultimate Fade-in slideshow (v2.1)

If anyone can tell me why this is I would be extremely gratefull.

tomws
Nov 30th, 2009, 03:18 PM
Firebug reports that you have an error in one of them. Invalid array length. One error will kill them all. The quick fix is to remove the last addition and then you can dig into what's wrong with it.

gmnightingale
Nov 30th, 2009, 05:58 PM
They both work independently absolutely fine! so I dont get what the error could be

Philip M
Nov 30th, 2009, 06:04 PM
There are two reasons why two or more scripts will not work together.

a) duplication of variable and/or function names (including e.g. for i = 0; i < length; i++)

b) multiple onload statements, where the second overwrites the first.

see:- http://www.javascriptkit.com/javatutors/multiplejava.shtml
and http://www.dyn-web.com/tutorials/combine.php

The simplest solution is to fire a set of functions when the page loads.


<script type="text/javascript">
window.onload = function() {
functionOne();
functionTwo();
}</script>

I have the idea that this specific question has come up before - try the forum search facility.

gmnightingale
Nov 30th, 2009, 06:33 PM
problem is this seems to be firing alot of things of can you please explain below is all the scripts that are fired in head,



<script type="text/javascript" src="jquery.min.js"></script>

<script type="text/javascript" src="fadeslideshow.js">

</script>

<script type="text/javascript">

var mygallery=new fadeSlideShow({
wrapperid: "fadeshow1",
dimensions: [220, 200],
imagearray: [
["images/demos/sdsasbuilt.jpg", "http://www.asbuiltsdsgroup.co.uk/", "_new", "Asbuilt SDS group front portal"],
["images/demos/sdsgroup.jpg", "http://www.sds-group.co.uk/", "_new", "SDS Asbuilt group front portal"],
["images/demos/gillyprint.jpg", "http://www.gillyprinters.com", "_new", "Gilly Print, professional labelling Website"],
["images/demos/firetradeasia.jpg", "http://www.hemminginfo.co.uk/index.cfm?fuseaction=home.products&producttypeid=2", "_new", "Hemming Information Group online Fire Trade Europe Directory ."],
["images/demos/timespace.jpg", "http://www.intensive-driving-schools.co.uk/", "_new", "Time and Space driving schools website"],
["images/partytubhire.jpg", "http://www.partytubhire.co.uk", "_new", "Party Tub Hire Website 'Relax in style'"],
["images/demos/arborventure.jpg", "http://www.arborventure.co.uk/", "_new", "Arbor Venture Website"]
],
displaymode: {type:'auto', pause:2500, cycles:0, wraparound:false},
persist: false, //remember last viewed slide and recall within same session?
fadeduration: 500, //transition duration (milliseconds)
descreveal: "ondemand",
togglerid: ""
})

</script>
<script type="text/javascript" src="js/prototype.js"></script>
<script type="text/javascript" src="js/scriptaculous.js?load=effects"></script>
<script type="text/javascript" src="js/lightbox.js"></script>
<script src="Scripts/AC_RunActiveContent.js" type="text/javascript"></script>

gmnightingale
Nov 30th, 2009, 07:53 PM
I have tried reading tutorials etc but they are not getting me anywhere. :-(

Old Pedant
Dec 1st, 2009, 03:35 AM
Since you show us only the HTML for your site, we can't download and inspect the JS files. If you showed us the LIVE site (that is, give us the URL), we could.

gmnightingale
Dec 1st, 2009, 09:16 PM
its in the first post i made at the top