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 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Jun 2004
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Help with countdown clock in javascript!

    i need help with this code. it countdown to a date, but i can't get it to a
    special time ,, hours, minutes and second

    the code is:

    <html>

    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
    <title>Ny sida 1</title>
    <form name="count">
    <input type="text" size="110" name="count2">
    </form>
    <script>
    var before="TEXT"
    var current="TEXT SOM SKALL KOMMA UPP NÄR TIDEN ÄR UTE"
    var montharray=new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec")

    function countdown(yr,m,d,h,min,s){
    theyear=yr;themonth=m;theday=d;theshours=h;theminute=min;thesecond=s
    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
    futurestring=montharray[m-1]+" "+d+", "+yr
    dd=Date.parse(futurestring)-Date.parse(todaystring)
    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*60))%(60*60*1000))%(60*1000))/1000*1)
    if(dday==0&&dhour==0&&dmin==0&&dsec==1){
    document.forms.count.count2.value=current
    return
    }
    else
    document.forms.count.count2.value="Endast "+dday+ " dagar, "+dhour+" timmar, "+dmin+" minuter, och "+dsec+" sekunder kvar till "+before
    setTimeout("countdown(theyear,themonth,theday)",1000)
    }
    countdown(2004,06,14,18,00,01)
    </script>
    </head>

    <body>

    </body>

    </html>

  • #2
    Banned
    Join Date
    Sep 2003
    Posts
    3,620
    Thanks
    0
    Thanked 0 Times in 0 Posts
    That looks like this script from Javascript Kit which you have tried to modify. Please edit your post and place the code into [code]...CODE HERE...[/code] tags and return the credits which you agreed not to remove when you got the script from Javascript Kit.

    /*
    Count down until any date script-
    By JavaScript Kit (www.javascriptkit.com)
    Over 200+ free scripts here!
    */
    Also, you may wish to P/M a moderator and ask to have this thread moved to the Dynamic Drive Scripts Help forum where it belongs.


  •  

    Posting Permissions

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