Главная » Файлы » Прочие скрипты » Яваскрипты

До даты X осталось... для uCoz
21.06.14, 18:03:20



Установка:

Вставляем следующий код туда, где хотим видеть данный блок:
Код
<!-- HEAD START HERE -->

  <!-- HEAD END HERE -->

  <center>

  <!-- BODY START HERE -->

  <script language="JavaScript">

  <!--
  function myFunction1(){
  if (date<=myDate) month1=12-(month-myMonth);
  else month1=11-(month-myMonth);
  }
  function myFunction2(){
  if (date>myDate) month1=(myMonth-month-1);
  else month1=(myMonth-month);
  }
  function myFunction3(){
  if (date<=myDate) month1=0;
  else month1=11;
  }

  function myFunction4(){
  if (month==2) date1=(28-date+myDate);
  if (month==4) date1=(30-date+myDate);
  if (month==6) date1=(30-date+myDate);
  if (month==9) date1=(30-date+myDate);
  if (month==11) date1=(30-date+myDate);
  if (month==1) date1=(31-date+myDate);
  if (month==3) date1=(31-date+myDate);
  if (month==5) date1=(31-date+myDate);
  if (month==7) date1=(31-date+myDate);
  if (month==8) date1=(31-date+myDate);
  if (month==10) date1=(31-date+myDate);
  if (month==12) date1=(31-date+myDate);
  }

  var date=(new Date()).getDate();
  var month=(new Date()).getMonth()+1;

  //Set Yuor Date.
  var myDate=[color=green]ДАТА[/color]
  var myMonth=[color=green]МЕСЯЦ[/color]
  if (month>myMonth) myFunction1();
  if (month<myMonth) myFunction2();
  if (month==myMonth) myFunction3();

  if (date<=myDate) date1=(myDate-date);
  if (date>myDate) myFunction4();

  if (month1==1) monthtxt=("month");
  if (month1>1 && month1<5) monthtxt=("months");
  if (month1>4) monthtxt=("monthes");

  if (date1==1, 21) datetxt=("день");
  if (date1>1 && date1<5) datetxt=("дня");
  if (date1>21 && date1<25) datetxt=("дней");
  if (date1>4 && date1<21) datetxt=("дней");
  if (date1>24 && date1<31) datetxt=("дней");

  var txt=("[color=green]ДО ДАТЫ Х ОСТАЛОСЬ[/color]:");
  if (month1==0 && date1==0) txt=("[color=green]НАЗВАНИЕ ДАТЫ Х[/color]");

  document.write('<font color="black" size="2">'+txt+'</font><br>');

  if (month1>0) document.write('<font color="black" size="2">'+month1+" "+monthtxt+'</font>');
  else document.write("");

  if (date1>0) document.write('<font color="black" size="2"> '+date1+" "+datetxt+'</font>');
  else document.write("");

  // -->
  </script>

  <!-- BODY END HERE -->


Внимательно вчитываемся в код и заменяем то, что написано по русски, на своё smile
Категория: Яваскрипты | Добавил: Apocalypse | Теги: осталось..., до, ucoz, для, даты
Просмотров: 491 | Загрузок: 0 | Рейтинг: 0.0/0
Всего комментариев: 0
Имя *:
Email: