View Full Version : Can you run two scripts one page?

Aug 23rd, 2010, 09:47 PM
Iv got a scrolling menu on my page using...

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.1/jquery.min.js"></script>
<script type="text/javascript" src="scripts.js"></script>

and i want to add a lightbox...

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

however whichever one is at the bottom is the only one that works? Can anyone please explain why this is? I gues they conflict? I read about window.onload but neither has that i also tried.
onLoad="initLightbox();" in my body tag.

Any help greatly apreciated, im hoping theres an easy fix! :-) :thumbsup:

Aug 23rd, 2010, 10:14 PM
Well, the problem comes from jQuery and Prototype running on the same page, while (I assume) neither of the two is running in compatibility mode.

The easiest solution that comes to mind is ditching prototype altogether and using a jQuery-based lightbox plug-in to avoid the two frameworks clashing together. Beyond that, if you must use both, I'd suggest reading up on either jQuery or Prototype's compatibility modes.

Aug 24th, 2010, 05:13 PM
ok thanks alot for the tip il see what i can find out on google. dont suppose u can recomend a jQuery-based lightbox plug-in?

also dumb question is it worth trying running them in compatability mode? if so how?