Results 1 to 2 of 2

Thread: Dynamic Countup Script - Number Formatting

  1. #1
    Join Date
    Nov 2008
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Dynamic Countup Script - Number Formatting

    1) Script Title: Dynamic Countup Script

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

    3) Describe problem: I am trying to customize the Dynamic Countup Script so that it displays double-digits at all times. For example, instead of "0 days, 0 hours, 0 minutes, 0 seconds", I want it to show "00 days, 00 hours, 00 minutes, 00 seconds". Here is what I have so far: http://beabigfish.com/dev/countup/. Any help is appreciated.

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

    Default

    Try finding the below line inside the script:

    Code:
    var result={days: dayfield, hours:hourfield, minutes:minutefield, seconds:secondfield}
    and replace that with:

    Code:
    var result={days: (dayfield<=9? "0" : "")+dayfield, hours:(hourfield<=9? "0" : "")+hourfield, minutes:(minutefield<=9? "0" : "")+minutefield, seconds:(secondfield<=9? "0" : "")+secondfield}
    DD Admin

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
  •