| 
| SparcO | Дата: Четверг, 16.07.2009, 04:02 | Сообщение # 1 |  |  Полковник Сообщений: 147 Репутация: 2 Статус: Offline | Возможно немного коряво, но работает! Суть: вывод сообщения о том, сколько дней осталось зарегистрированному пользователю до дня рождения!
 
 Code <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;
 
 <?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>
 Х.У.Й.-Харьковский Универсальный Йод
 |  |  |  |  |