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 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Aug 2010
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Can you run two scripts one page?

    Iv got a scrolling menu on my page using...

    Code:
    <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...

    Code:
    <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.
    Code:
    onLoad="initLightbox();"
    in my body tag.

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

  • #2
    Regular Coder
    Join Date
    Feb 2009
    Location
    Wheeling, IL
    Posts
    358
    Thanks
    5
    Thanked 62 Times in 60 Posts
    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.
    The way to success is to assume that there are no impossible things. After all, if you think something is impossible, you will not even try to do it.

    How to ask smart questions?

  • #3
    New to the CF scene
    Join Date
    Aug 2010
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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?


  •  

    Posting Permissions

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