Показать сообщение отдельно
  #7 (permalink)  
Старый 03.06.2014, 22:23
Новичок на форуме
Отправить личное сообщение для kiri1108 Посмотреть профиль Найти все сообщения от kiri1108
 
Регистрация: 18.01.2014
Сообщений: 7

<script type="text/javascript">
function newYearIn()
{
 var now = new Date();
 var newYear = new Date("Mar,27,2015,23:59:00");
 var totalRemains = (newYear.getTime()-now.getTime());
 if (totalRemains>1)
    {
     var RemainsSec=(parseInt(totalRemains/1000));
    var RemainsFullDays=(parseInt(RemainsSec/(24*60*60)));
    var secInLastDay=RemainsSec-RemainsFullDays*24*3600;
    var RemainsFullHours=(parseInt(secInLastDay/3600));
    if (RemainsFullHours<10){RemainsFullHours="0"+RemainsFullHours};
    var secInLastHour=secInLastDay-RemainsFullHours*3600;
    var RemainsMinutes=(parseInt(secInLastHour/60));
    if (RemainsMinutes<10){RemainsMinutes="0"+RemainsMinutes};
    var lastSec=secInLastHour-RemainsMinutes*60;
    if (lastSec<10){lastSec="0"+lastSec};
  var mcend = Date.parse("Mar,27,2015,23:59:00");
  var mcnow = now.getTime();
  var mc = ((mcend-mcnow)/10).toFixed(0).substr(8);
  
    RemainsFullHours = RemainsFullHours.split('').join("&nbsp;&nbsp;");
  
  document.getElementById('newyear3').innerHTML = "<span style='padding-right: 18px;'>0 0</span><span style='padding-right: 18px;'>"+RemainsFullHours+"</span><span style='padding-right: 18px;'>"+RemainsMinutes+"</span><span style='padding-right: 18px;'>"+lastSec+"</span>";
  
  document.getElementById('newyear4').innerHTML = "<span style='padding-right: 18px;'>0 0</span><span style='padding-right: 18px;'>"+RemainsFullHours+"</span><span style='padding-right: 18px;'>"+RemainsMinutes+"</span><span style='padding-right: 18px;'>"+lastSec+"</span>";
   
  document.getElementById('newyear5').innerHTML = "<span style='padding-right: 18px;'>0 0</span><span style='padding-right: 18px;'>"+RemainsFullHours+"</span><span style='padding-right: 18px;'>"+RemainsMinutes+"</span><span style='padding-right: 18px;'>"+lastSec+"</span>";
    setTimeout("newYearIn()",10);
 }
   else {document.getElementById("newyear3").innerHTML = "<span style='padding-right: 18px;'>00</span><span style='padding-right: 18px;'>00</span><span style='padding-right: 18px;'>00</span>00"; document.getElementById("newyear4").innerHTML = "<span style='padding-right: 18px;'>00</span><span style='padding-right: 18px;'>00</span><span style='padding-right: 18px;'>00</span>00"; document.getElementById("newyear5").innerHTML = "00:00:00";}
}
</script>


<body onLoad="newYearIn();">


<div id="newyear3"></div>
<div id="newyear4"></div>
<div id="newyear5"></div>


</body>
Ответить с цитированием