• You will need to login or register before you can post a message. If you already have an Agriville account login by clicking the login icon on the top right corner of the page. If you are a new user you will need to Register.

Announcement

Collapse
No announcement yet.

Days Until Christmas script

Collapse
X
Collapse
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Days Until Christmas script

    <script type="text/javascript" language="javascript">
    <!--
    function iCounter() {
    var nxtXmas=(new Date().getMonth()>=11 && new Date().getDate()>25)? (new Date().getFullYear()) 1 : new Date().getFullYear();
    var cDateTime=new Date();
    var tDateTime=new Date("December 25, " nxtXmas " 0:0:00");
    //var tDateTime=new Date("June 11, " nxtXmas " 0:0:00");
    var timeDiff=(tDateTime-cDateTime)/1000; //difference btw target date and current date, in seconds
    var oneMin=60; //1 minute in seconds
    var oneHour=60*60; //1 hour in seconds
    var oneDay=60*60*24; //1 day in seconds
    var totalDay=Math.floor(timeDiff/oneDay);
    var totalHour=Math.floor((timeDiff-totalDay*oneDay)/oneHour);
    var totalMin=Math.floor((timeDiff-totalDay*oneDay-totalHour*oneHour)/oneMin);
    var totalSec=Math.floor((timeDiff-totalDay*oneDay-totalHour*oneHour-totalMin*oneMin));
    //Disply Christmas Countdown to Web Browser
    document.getElementById("nxtXmas").innerHTML = totalDay ' <span>Days,</span> ' totalHour ' <span>Hours,</span> ' totalMin ' <span>Minute,</span> ' totalSec ' <span>Seconds,</span><br /> Remain till the Christmas';
    setTimeout("iCounter()",1000);
    }

    iCounter();
    -->
    </script>

    #2
    <script type="text/javascript" language="javascript"> <!-- function iCounter() { var nxtXmas=(new Date().getMonth()>=11 && new Date().getDate()>25)? (new Date().getFullYear()) 1 : new Date().getFullYear(); var cDateTime=new Date(); var tDateTime=new Date("December 25, " nxtXmas " 0:0:00"); //var tDateTime=new Date("June 11, " nxtXmas " 0:0:00"); var timeDiff=(tDateTime-cDateTime)/1000; //difference btw target date and current date, in seconds var oneMin=60; //1 minute in seconds var oneHour=60*60; //1 hour in seconds var oneDay=60*60*24; //1 day in seconds var totalDay=Math.floor(timeDiff/oneDay); var totalHour=Math.floor((timeDiff-totalDay*oneDay)/oneHour); var totalMin=Math.floor((timeDiff-totalDay*oneDay-totalHour*oneHour)/oneMin); var totalSec=Math.floor((timeDiff-totalDay*oneDay-totalHour*oneHour-totalMin*oneMin)); //Disply Christmas Countdown to Web Browser document.getElementById("nxtXmas").innerHTML = totalDay ' <span>Days,</span> ' totalHour ' <span>Hours,</span> ' totalMin ' <span>Minute,</span> ' totalSec ' <span>Seconds,</span><br /> Remain till the Christmas'; setTimeout("iCounter()",1000); }

    iCounter(); --> </script>

    Comment


      #3
      It won't work. Oh well will have to count the days the old fashion way.

      Comment

      • Reply to this Thread
      • Return to Topic List
      Working...