Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 3 of 3
  1. #1
    Senior Member
    Join Date
    Mar 2010
    Posts
    104
    Member #
    21316
    Liked
    1 times
    Hi,

    I have developed a website but there are 2 javascript codes that are conflicting each other. Only 1 works depending on which javascript code is below the other.
    1 script is a datepicker and the other script is a digital clock.

    The Javascript code for the datepicker is:

    Code:
        <link rel="stylesheet" href="datepicker/development-bundle/themes/base/jquery.ui.all.css">
        <script src="datepicker/development-bundle/jquery-1.5.1.js"></script>
        <script src="datepicker/development-bundle/ui/jquery.ui.core.js"></script>
        <script src="datepicker/development-bundle/ui/jquery.ui.widget.js"></script>
        <script src="datepicker/development-bundle/ui/jquery.ui.datepicker.js"></script>
        <link rel="stylesheet" href="datepicker/development-bundle/demos/demos.css">
        <script>
        $(function() {
            $( "#datepicker, #datepicker2, #datepicker3, #datepicker4, #datepicker5, #datepicker6, #datepicker7, #datepicker8, #datepicker9, #datepicker10, #datepicker11, #datepicker12" ).datepicker({
                numberOfMonths: 3,
                showButtonPanel: true
            });
        });
        </script>
    Just below the datepicker script is the digital clock script:


    Code:
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js" type="text/javascript"></script>
        <script src="jquery.MyDigitclock.js"></script>
     
    <script>
            $(function(){
                $("#clock1").MyDigitClock();
                $("#clock2").MyDigitClock({
                    fontSize:50,
                    fontFamily:"Arial",
                    fontColor: "#000",
                    fontWeight:"bold",
                    bAmPm:true,
                    background:'#fff',
                    bShowHeartBeat:true
                    });
                $("#clock3").MyDigitClock({
                    fontSize:150,
                    fontColor:"grey",
                    background:"#fff",
                    fontWeight:"bold",
                    timeFormat: '{HH}<span id="ch1">:</span>{MM}'}
                );
            });
        </script>
    How can I make it so that both scripts are working??
    I've done some research resolve the problem but I need elaborate answers, please (as I'm not very knowledgeable at javascript)

    Thanks guys!

  2.  

  3. #2
    Member
    Join Date
    May 2011
    Location
    Baltimore, MD
    Posts
    60
    Member #
    27796
    Liked
    11 times
    You are importing jQuery twice? version 1.5.1 in the first example and 1.5.2 in the second. Try simply importing 1.5.1 and remove the import for 1.5.2.
    reflex84 likes this.
    /phillihp/
    Check out my blog @ http://www.phillihp.com
    ~Web~Mobile~Hacking~Tech~Gadgets~More~

  4. #3
    Senior Member
    Join Date
    Mar 2010
    Posts
    104
    Member #
    21316
    Liked
    1 times
    Hi,

    Thanks so much Phillihp - Quick response and that worked!!


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 05:34 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com