Cool count down timer sourcecode bug fixed !

Discussion in 'Javascript' started by HeroinNO.4@gmail.com, Oct 31, 2006.

  1. Guest

    Hello guys, sorry for my last version has a little "feature"(MS always
    call his bug "feature"), and now I fixed it and show the source to you
    all ! Just as the last version, copy the code below and save in a .htm
    file, fox example : "1.htm", and run it in a browser support JavaScript
    1.1 or later, the cool count down timer will show you ! If it doesn't
    work, you may open http://www.fillweb.com in IE, and View->Source to
    see the latest version of source code !



    <html>
    <head>
    <meta http-equiv="Content-Language" content="en-us">
    <meta http-equiv="Content-Type" content="text/html;
    charset=windows-1252">
    <title>Welcome to Fillweb home page</title>
    <meta name="keywords" content="fillweb, form filler, fill forms
    automatically, account logon login, single sign on, fill web forms,
    fill online forms automatically, form filling software, ai web
    automatic auto fill out forms fill in forms">
    <script language="JavaScript">
    <!--
    var timerID;
    var timerRunning = false;
    var today = new Date();
    var startday = new Date();
    var secPerDay = 0;
    var minPerDay = 0;
    var hourPerDay = 0;
    var secsLeft = 0;
    var secsRound = 0;
    var secsRemain = 0;
    var minLeft = 0;
    var minRound = 0;
    var minRemain = 0;
    var timeRemain = 0;
    /* This function will stop the clock */
    function stopclock()
    {
    if(timerRunning)
    clearTimeout(timerID);
    timerRunning = false;
    }
    /* This function will start the clock */
    function startclock()
    {
    stopclock();
    countdown();
    }
    function startclock_cn()
    {
    stopclock();
    showtime_cn();
    }
    /* This function will display the count-up */
    function countdown()
    {
    startday = new Date("November 01, 2006 00:00 GMT");
    startday.setYear("2006");
    today = new Date();
    secsPerDay = 1000 ;
    minPerDay = 60 * 1000 ;
    hoursPerDay = 60 * 60 * 1000;
    PerDay = 24 * 60 * 60 * 1000;
    /* Seconds */
    secsLeft = (startday.getTime() - today.getTime()) / minPerDay;
    secsRound = Math.round(secsLeft);
    secsRemain = secsLeft - secsRound;
    secsRemain = (secsRemain < 0) ? secsRemain = 60 - ((secsRound -
    secsLeft) * 60) : secsRemain = (secsLeft - secsRound) * 60;
    secsRemain = Math.round(secsRemain);
    /* Minutes */
    minLeft = ((startday.getTime() - today.getTime()) / hoursPerDay);
    minRound = Math.round(minLeft);
    minRemain = minLeft - minRound;
    minRemain = (minRemain < 0) ? minRemain = 60 - ((minRound - minLeft) *
    60) : minRemain = ((minLeft - minRound) * 60);
    minRemain = Math.round(minRemain - 0.495);
    /* Hours */
    hoursLeft = ((startday.getTime() - today.getTime()) / PerDay);
    hoursRound = Math.round(hoursLeft);
    hoursRemain = hoursLeft - hoursRound;
    hoursRemain = (hoursRemain < 0) ? hoursRemain = 24 - ((hoursRound -
    hoursLeft) * 24) : hoursRemain = ((hoursLeft - hoursRound) * 24);
    hoursRemain = Math.round(hoursRemain - 0.5);
    /* Days */
    daysLeft = ((startday.getTime() - today.getTime()) / PerDay);
    daysLeft = (daysLeft - 0.5);
    daysRound = Math.round(daysLeft);
    daysRemain = daysRound;
    /* Time */
    if (daysRemain < 2)
    {
    day_rem = " day, "
    }
    else
    {
    day_rem = " days, "
    }
    if (hoursRemain < 2)
    {
    hour_rem = " hour, "
    }
    else
    {
    hour_rem = " hours, "
    }
    if (minRemain < 2)
    {
    min_rem = " minute, "
    }
    else
    {
    min_rem = " minutes, "
    }
    if (secsRemain < 2)
    {
    sec_rem = " second"
    }
    else
    {
    sec_rem = " seconds"
    }
    timeRemain = "Fillweb is coming in " + daysRemain + day_rem +
    hoursRemain + hour_rem + minRemain +
    min_rem + secsRemain + sec_rem;
    document.counter.face.value = timeRemain;
    timerID = setTimeout("countdown()",1000);
    timerRunning = true;
    }
    //-->
    </script>
    </head>
    <body onLoad="startclock()" bgcolor="#000000">
    <div align="center">
    <table border="0" width="700" height="333" cellspacing="2">
    <tr>
    <td background="images/milkyway.jpg"></td>
    </tr>
    <tr>
    <td align="center" height="18" valign="bottom">
    <form name="counter" style="position: relative">
    <input type="text" name="face" size="100" value="A browser supporting
    JavaScript 1.1+ is needed." style="border:1px solid #000000;
    background-color:#000000; font-size:9pt; color:#FFFFFF;
    text-align:center; position:relative; ">
    </form>
    </td>
    </tr>
    </table>
    </div>
    <script src="http://www.google-analytics.com/urchin.js"
    type="text/javascript">
    </script>
    <script type="text/javascript">
    _uacct = "UA-859503-1";
    urchinTracker();
    </script>
    </body>
    </html>
     
    , Oct 31, 2006
    #1
    1. Advertising

  2. Randy Webb Guest

    said the following on 10/31/2006 2:24 AM:
    > Hello guys, sorry for my last version has a little "feature"(MS always
    > call his bug "feature"), and now I fixed it and show the source to you
    > all ! Just as the last version, copy the code below and save in a .htm
    > file, fox example : "1.htm", and run it in a browser support JavaScript
    > 1.1 or later, the cool count down timer will show you !


    And then find one that is actually worth having.

    --
    Randy
    Chance Favors The Prepared Mind
    comp.lang.javascript FAQ - http://jibbering.com/faq
    Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
     
    Randy Webb, Oct 31, 2006
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Tony Arcieri
    Replies:
    14
    Views:
    455
    Tony Arcieri
    Dec 9, 2010
  2. Tony Arcieri
    Replies:
    0
    Views:
    410
    Tony Arcieri
    Dec 14, 2010
  3. Replies:
    2
    Views:
    408
    Randy Webb
    Oct 31, 2006
  4. Replies:
    1
    Views:
    1,022
    Evertjan.
    Nov 11, 2006
  5. Replies:
    2
    Views:
    151
    Dr J R Stockton
    Nov 17, 2006
Loading...

Share This Page