Results 1 to 6 of 6

Thread: To all pro's - How to customize this script

  1. #1
    Join Date
    Mar 2008
    Posts
    4
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default To all pro's - How to customize this script

    1) Script Title: Dynamic Countdown Script

    2) Script URL (on DD): http://www.dynamicdrive.com/dynamici...dhtmlcount.htm

    3) Describe problem: Customize this script so it can do the following things:

    1. The script to start at 09:00:00 and countdown to 18:00:00 every Monday to Friday and Sunday.

    2. On saturdays it should not show at all


    I'll really appriciate it if somebody would help me customize it. I'm not that gould at scripting and have tried to make it work for over 2 days with no luck at all...

  2. #2
    Join Date
    Aug 2004
    Posts
    10,143
    Thanks
    3
    Thanked 1,008 Times in 993 Posts
    Blog Entries
    16

    Default

    The code would look something like the below. The parts in red are new from your normal code:

    Code:
    <script type="text/javascript">
    
    var now=new Date()
    var end=new Date()
    end.setHours(18)
    end.setMinutes(0)
    end.setSeconds(0)
    
    if (now.getDay()!=6 && now.getHours()>=9 && now.getHours()<18){ //if not Sat and current time is between 6 and 18
    var futuredate=new cdtime("countdowncontainer", end)
    futuredate.displaycountdown("days", formatresults)
    }
    
    </script>

  3. The Following User Says Thank You to ddadmin For This Useful Post:

    pirilti (03-16-2008)

  4. #3
    Join Date
    Mar 2008
    Posts
    4
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default Thank you so much...

    It's working now...

    You are the best...

  5. #4
    Join Date
    Mar 2008
    Posts
    4
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default One more thing...???

    Is this possible.....???

    I want this script to change the first argument which in this case is hours.


    At this moment it shows: 1 hours 10 min. 3 sec. left

    Can I make this show like: 1 hour 10 min. 3 sec. left

    And also still show hours when it's equal to 2 or more...

    Thanks in advance
    Last edited by pirilti; 03-16-2008 at 03:18 PM. Reason: mistyped

  6. #5
    Join Date
    Aug 2004
    Posts
    10,143
    Thanks
    3
    Thanked 1,008 Times in 993 Posts
    Blog Entries
    16

    Default

    In your formatresults() function, you'd simply add a little test for "1" hour in the second argument, something like:

    Code:
    function formatresults(){
    if (this.timesup==false){//if target date/time not yet met
    var hoursfield=arguments[1]+(arguments[1]==1? " hour " : " hours ")
    var displaystring=arguments[0]+" days "+hoursfield+arguments[2]+" minutes "+arguments[3]+" seconds left until March 23, 2009 18:25:00"
    }
    else{ //else if target date/time met
    var displaystring="Future date is here!"
    }
    return displaystring
    }
    Last edited by ddadmin; 03-17-2008 at 11:20 PM.

  7. The Following User Says Thank You to ddadmin For This Useful Post:

    pirilti (03-17-2008)

  8. #6
    Join Date
    Mar 2008
    Posts
    4
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default Simply the best...

    Thank you so much... This is just amazing...

Bookmarks

Posting Permissions

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