Статистика Форума
Последние обновленные темы
Самые популярные темы
Активисты форума
Авторитеты форума
Bioshock 2

Ответил: WurDalaK
Mass Effect

Ответил: greendayone82
Dead Space

Ответил: greendayone82
Беседы у костра

Создал: WurDalaK; ответов: 2105
Вопросы по модострою

Создал: WurDalaK; ответов: 1161
Ходка №1

Создал: Алеся; ответов: 301
Какой трек у вас сейчас и...

Создал: Never; ответов: 65
Злой админ

Создал: WurDalaK; ответов: 54
WurDalaK

Постов: 2057
Возрожденный

Постов: 1621
Wo1fRam

Постов: 592
Алеся

Постов: 183
Marsel

Постов: 174
WurDalaK

Уважение: 28
Venus

Уважение: 23
Never

Уважение: 17
Возрожденный

Уважение: 13
Wo1fRam

Уважение: 13

  • Страница 1 из 1
  • 1
Модератор форума: XemorDio  
Форум » Веб-мастерская » Скрипты » Сколько осталось до дня рождения
Сколько осталось до дня рождения
  WurDalaK
Дата: Суббота, 05.04.2014, 00:42 | Сообщение # 1
Mysterious asari
Статус
Страж
Группа Администраторы
Сообщений 2057
Награды 9
-
28
+
Код
<script type="text/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;     

     <?if(substr($USER_BIRTHDAY$,8,2)='01')?>var myDate=1<?endif?>  
     <?if(substr($USER_BIRTHDAY$,8,2)='02')?>var myDate=2<?endif?>  
     <?if(substr($USER_BIRTHDAY$,8,2)='03')?>var myDate=3<?endif?>  
     <?if(substr($USER_BIRTHDAY$,8,2)='04')?>var myDate=4<?endif?>  
     <?if(substr($USER_BIRTHDAY$,8,2)='05')?>var myDate=5<?endif?>  
     <?if(substr($USER_BIRTHDAY$,8,2)='06')?>var myDate=6<?endif?>  
     <?if(substr($USER_BIRTHDAY$,8,2)='07')?>var myDate=7<?endif?>  
     <?if(substr($USER_BIRTHDAY$,8,2)='08')?>var myDate=8<?endif?>  
     <?if(substr($USER_BIRTHDAY$,8,2)='09')?>var myDate=9<?endif?>  
     <?if(substr($USER_BIRTHDAY$,8,2)='10')?>var myDate=10<?endif?>  
     <?if(substr($USER_BIRTHDAY$,8,2)='11')?>var myDate=11<?endif?>  
     <?if(substr($USER_BIRTHDAY$,8,2)='12')?>var myDate=12<?endif?>  
     <?if(substr($USER_BIRTHDAY$,8,2)='13')?>var myDate=13<?endif?>  
     <?if(substr($USER_BIRTHDAY$,8,2)='14')?>var myDate=14<?endif?>  
     <?if(substr($USER_BIRTHDAY$,8,2)='15')?>var myDate=15<?endif?>  
     <?if(substr($USER_BIRTHDAY$,8,2)='16')?>var myDate=16<?endif?>  
     <?if(substr($USER_BIRTHDAY$,8,2)='17')?>var myDate=17<?endif?>  
     <?if(substr($USER_BIRTHDAY$,8,2)='18')?>var myDate=18<?endif?>  
     <?if(substr($USER_BIRTHDAY$,8,2)='19')?>var myDate=19<?endif?>  
     <?if(substr($USER_BIRTHDAY$,8,2)='20')?>var myDate=20<?endif?>  
     <?if(substr($USER_BIRTHDAY$,8,2)='21')?>var myDate=21<?endif?>  
     <?if(substr($USER_BIRTHDAY$,8,2)='22')?>var myDate=22<?endif?>  
     <?if(substr($USER_BIRTHDAY$,8,2)='23')?>var myDate=23<?endif?>  
     <?if(substr($USER_BIRTHDAY$,8,2)='24')?>var myDate=24<?endif?>  
     <?if(substr($USER_BIRTHDAY$,8,2)='25')?>var myDate=25<?endif?>  
     <?if(substr($USER_BIRTHDAY$,8,2)='26')?>var myDate=26<?endif?>  
     <?if(substr($USER_BIRTHDAY$,8,2)='27')?>var myDate=27<?endif?>  
     <?if(substr($USER_BIRTHDAY$,8,2)='28')?>var myDate=28<?endif?>  
     <?if(substr($USER_BIRTHDAY$,8,2)='29')?>var myDate=29<?endif?>  
     <?if(substr($USER_BIRTHDAY$,8,2)='30')?>var myDate=30<?endif?>  
     <?if(substr($USER_BIRTHDAY$,8,2)='31')?>var myDate=31<?endif?>  

     <?if(substr($USER_BIRTHDAY$,5,2)='01')?>var myMonth=1<?endif?>  
     <?if(substr($USER_BIRTHDAY$,5,2)='02')?>var myMonth=2<?endif?>  
     <?if(substr($USER_BIRTHDAY$,5,2)='03')?>var myMonth=3<?endif?>  
     <?if(substr($USER_BIRTHDAY$,5,2)='04')?>var myMonth=4<?endif?>  
     <?if(substr($USER_BIRTHDAY$,5,2)='05')?>var myMonth=5<?endif?>  
     <?if(substr($USER_BIRTHDAY$,5,2)='06')?>var myMonth=6<?endif?>  
     <?if(substr($USER_BIRTHDAY$,5,2)='07')?>var myMonth=7<?endif?>  
     <?if(substr($USER_BIRTHDAY$,5,2)='08')?>var myMonth=8<?endif?>  
     <?if(substr($USER_BIRTHDAY$,5,2)='09')?>var myMonth=9<?endif?>  
     <?if(substr($USER_BIRTHDAY$,5,2)='10')?>var myMonth=10<?endif?>  
     <?if(substr($USER_BIRTHDAY$,5,2)='11')?>var myMonth=11<?endif?>  
     <?if(substr($USER_BIRTHDAY$,5,2)='12')?>var myMonth=12<?endif?>  

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=("месяц");     
if (month1>1 && month1<5) monthtxt=("месяцa");     
if (month1>4) monthtxt=("месяцев");     
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=("До дня рождения:");     
if (month1==0 && date1==0) txt=("Сегодня мой день рождения! :)))");     
document.write('<font color="#000000">'+txt+'</font>');     
if (month1>0) document.write('<font color="#000000">'+month1+" "+monthtxt+'</font>');     
else document.write("");     
if (date1>0) document.write('<font color="#000000"> '+date1+" "+datetxt+'</font>');     
else document.write("");     
// -->     
</script>

Хочешь сказать спасибо? Ставь + в репутацию!
Спрятать подпись Спрятать все подписи
 
Форум » Веб-мастерская » Скрипты » Сколько осталось до дня рождения
  • Страница 1 из 1
  • 1
Поиск:
Мини-чат
Яндекс.Метрика