Page 1 of 3 123 LastLast
Results 1 to 10 of 25

Thread: Looking for a count up script

  1. #1
    Join Date
    Oct 2004
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Looking for a count up script

    Hello,

    I am hoping someone here can help me. I am looking for a count up script to put on my goddaughter’s web site. I have found a count up script at http://www.dynamicdrive.com/dynamici...countingup.htm . However, this script show only shows d,h,m,s. I would like to find something to show y,m,d,h,m can any one help me with this.

  2. #2
    Join Date
    Aug 2004
    Location
    Brighton
    Posts
    1,563
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    I'll modify the script for you and post it when completed

    *gets calculator out*

    cr3ative
    A retired member, drop me a line through my site if you'd like to find me!
    cr3ative media | read the stickies

  3. #3
    Join Date
    Aug 2004
    Location
    Brighton
    Posts
    1,563
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    YMHMS script i'm afraid. I just couldn't get days to work, because of this:

    To get years we divide days by 365
    To get months we divide years by 12 and take off the amount of months already stated for in the years, easy enough
    But to get days in this context, we need to take the months and years already stated in the previous two... and its too late at night for me to handle this! (edit: by the way, I'm in GMT. It's not really 8:00 PM.)

    Still, here's the YMHMS script.

    Code:
    <script language="JavaScript1.2">
    
    //Dynamic countup Script- © Dynamic Drive (www.dynamicdrive.com)
    //For full source code, 100's more DHTML scripts, and TOS,
    //visit http://www.dynamicdrive.com
    
    function setcountup(theyear,themonth,theday){
    yr=theyear;mo=themonth;da=theday
    }
    
    //////////CONFIGURE THE countup SCRIPT HERE//////////////////
    
    //STEP 1: Configure the date to count up from, in the format year, month, day:
    //This date should be less than today
    setcountup(1999,3,2)
    
    //STEP 2: Configure text to be attached to count up
    var displaymessage="have passed since the debut of our site!"
    
    //STEP 3: Configure the below 5 variables to set the width, height, background color, and text style of the countup area
    var countupwidth='95%'
    var countupheight='20px' //applicable only in NS4
    var countupbgcolor='lightyellow'
    var opentags='<font face="Verdana"><small>'
    var closetags='</small></font>'
    
    //////////DO NOT EDIT PASS THIS LINE//////////////////
    
    var montharray=new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec")
    var crosscount=''
    
    function start_countup(){
    if (document.layers)
    document.countupnsmain.visibility="show"
    else if (document.all||document.getElementById)
    crosscount=document.getElementById&&!document.all?document.getElementById("countupie") : countupie
    countup()
    }
    
    if (document.all||document.getElementById)
    document.write('<span id="countupie" style="width:'+countupwidth+'; background-color:'+countupbgcolor+'"></span>')
    
    window.onload=start_countup
    
    
    function countup(){
    var today=new Date()
    var todayy=today.getYear()
    if (todayy < 1000)
    todayy+=1900
    var todaym=today.getMonth()
    var todayd=today.getDate()
    var todayh=today.getHours()
    var todaymin=today.getMinutes()
    var todaysec=today.getSeconds()
    var todaystring=montharray[todaym]+" "+todayd+", "+todayy+" "+todayh+":"+todaymin+":"+todaysec
    paststring=montharray[mo-1]+" "+da+", "+yr
    dd=Date.parse(todaystring)-Date.parse(paststring)
    dyear=Math.floor(dd/(60*60*1000*24*365)*1)
    dmonth=Math.floor(dd/(60*60*1000*24*12)/(dyear*12))
    dhour=Math.floor((dd%(60*60*1000*24))/(60*60*1000)*1)
    dmin=Math.floor(((dd%(60*60*1000*24))%(60*60*1000))/(60*1000)*1)
    dsec=Math.floor((((dd%(60*60*1000*24))%(60*60*1000))%(60*1000))/1000*1)
    
    if (document.layers){
    document.countupnsmain.document.countupnssub.document.write(opentags+dyear+" years, "+dmonth+" months, "+dhour+" hours, "+dmin+" minutes, and "+dsec+" seconds "+displaymessage+closetags)
    document.countupnsmain.document.countupnssub.document.close()
    }
    else if (document.all||document.getElementById)
    crosscount.innerHTML=opentags+dyear+" years, "+dmonth+" months, "+dhour+" hours, "+dmin+" minutes, and "+dsec+" seconds "+displaymessage+closetags
    
    setTimeout("countup()",1000)
    }
    </script>
    
    <ilayer id="countupnsmain" width=&{countupwidth}; height=&{countupheight}; bgColor=&{countupbgcolor}; visibility=hide><layer id="countupnssub" width=&{countupwidth}; height=&{countupheight}; left=0 top=0></layer></ilayer>
    If you'll excuse me, I have to collapse now.

    cr3ative
    A retired member, drop me a line through my site if you'd like to find me!
    cr3ative media | read the stickies

  4. #4
    Join Date
    Feb 2005
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    anyone willing to update this to include days for me?

    Also, I'd love it if in the countup, it didn't just count up from a specific day, but a TIME, too.

    I want to count up from 11:40 PM EST on 10/27/04. Just 10/27/04 isn't going to cut it for me!
    Last edited by burnfactor; 02-09-2005 at 01:03 AM.

  5. #5
    Join Date
    Feb 2005
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    I'm trying to put the counter up on my sons site for the year, months, and days since he passed. I used your directions above but I don't know how to get the days. I have the counter on his page at www.hayeskent.com/resting/restingplace.html

  6. #6
    Join Date
    Jun 2005
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Hi there. I'm also looking for a countup script that will count from a specific date and a time - showing then months, days, hours and seconds.

    Thanks.

  7. #7
    Join Date
    Jun 2005
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    got the answer, thanks

  8. #8
    Join Date
    Jul 2005
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    hey. can someone send me the edited code which starts from a specific time and shows d h m s

  9. #9
    Join Date
    Jun 2005
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Here's the countup script - it works. Just cut and paste, follow the instructions.

    Bob

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>

    </head>

    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

    <title>Bob's countup script</title>

    <body>
    <p>It's been


    <script language="JavaScript1.2" type="text/javascript">function setcountup(theyear,themonth,theday){
    yr=theyear;mo=themonth;da=theday
    }

    //////////CONFIGURE THE countup SCRIPT HERE//////////////////

    //STEP 1: Configure the date to count up from, in the format year, month, day:
    //This date should be less than today
    setcountup(2005,8,01)

    //STEP 2: Configure text to be attached to count up
    var displaymessage="since Bob stopped smoking on August 1st, 2005 at 10am ."



    //STEP 3: Configure the below 5 variables to set the width, height, background color, and text style of the countup area
    var countupwidth='90%'
    var countupheight='40px' //applicable only in NS4
    var countupbgcolor=''
    var opentags='<font face="Verdana"><large>'
    var closetags='</large></font>'

    //////////DO NOT EDIT PASS THIS LINE//////////////////

    var montharray=new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec")
    var crosscount=''

    function start_countup(){
    if (document.layers)
    document.countupnsmain.visibility="show"
    else if (document.all||document.getElementById)
    crosscount=document.getElementById&&!document.all?document.getElementById("countupie") : countupie
    countup()
    }

    if (document.all||document.getElementById)
    document.write('<span id="countupie" style="width:'+countupwidth+'; background-color:'+countupbgcolor+'"></span>')

    window.onload=start_countup


    function countup(){
    var today=new Date()
    var todayy=today.getYear()
    if (todayy < 1000)
    todayy+=1900
    var todaym=today.getMonth()
    var todayd=today.getDate()
    var todayh=today.getHours()
    var todaymin=today.getMinutes()
    var todaysec=today.getSeconds()
    var todaystring=montharray[todaym]+" "+todayd+", "+todayy+" "+todayh+":"+todaymin+":"+todaysec
    paststring=montharray[mo-1]+" "+da+", "+yr
    paststring="10:00"+montharray[mo-1]+" "+da+", "+yr
    dd=Date.parse(todaystring)-Date.parse(paststring)
    dday=Math.floor(dd/(60*60*1000*24)*1)
    dhour=Math.floor((dd%(60*60*1000*24))/(60*60*1000)*1)
    dmin=Math.floor(((dd%(60*60*1000*24))%(60*60*1000))/(60*1000)*1)
    dsec=Math.floor((((dd%(60*60*1000*24))%(60*60*1000))%(60*1000))/1000*1)

    if (document.layers){
    document.countupnsmain.document.countupnssub.document.write(opentags+dday+ " days, "+dhour+" hours, "+dmin+" minutes, and "+dsec+" seconds "+displaymessage+closetags)
    document.countupnsmain.document.countupnssub.document.close()
    }
    else if (document.all||document.getElementById)
    crosscount.innerHTML=opentags+dday+ " days, "+dhour+" hours, "+dmin+" minutes, and "+dsec+" seconds "+displaymessage+closetags

    setTimeout("countup()",1000)
    }
    </script>
    <p> COUNTUP SCRIPT</p>
    </body>
    </html>

  10. #10
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    2,500 views of this?!
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

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
  •