Главная Форум Фильмы Онлайн Фотоальбом Статьи Скачать Радио Профиль Выход
[ Новые сообщения · Участники · Правила форума · Поиск · RSS ]
  • Страница 1 из 1
  • 1
Модератор форума: BATON  
Сколько дней осталось пользователю до дня рождения
BoPoHДата: Вторник, 21.04.2009, 16:45:42 | Сообщение # 1
Подполковник
Сообщений: 118
Награды: 3
Репутация: 6
Статус: Offline
908414

Возможно немного коряво, но работает!
Суть: вывод сообщения о том, сколько дней осталось зарегистрированному пользователю до дня рождения!
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>
 
  • Страница 1 из 1
  • 1
Поиск:

Статистика Форума
Последние темы Читаемые темы Лучшие пользователи Новые пользователи

Расскажите о своём го...

(3)

Предложение-Вопрос но...

(8)

Contry

(0)

находкинские оптовые ...

(0)

Assigoarish

(0)

футболка с оленем -5...

(0)

дизайн майки -56585

(0)

майки для молодоженов...

(0)

мужские модные майки ...

(0)

Игровые автоматы в Ка...

(0)

Ассоциации

(315)

Города

(96)

Игра слов

(55)

раздача ICQ №1

(48)

Набор модераторов фор...

(46)

Слуховая терапия А.То...

(39)

Разделы форума

(34)

3 буквЫ

(30)

Флудилка

(27)

Скриншоты

(23)

Аладин

(459 Постов)

UrBaN575

(355 Постов)

hypnose

(294 Постов)

AliveZloyB

(236 Постов)

BoPoH

(118 Постов)

D1M14

(111 Постов)

Dart_Mysua

(79 Постов)

Hanter@

(55 Постов)

Phoenix234

(51 Постов)

Owl

(31 Постов)

did

(18.06.2025)

DavidZet

(01.08.2023)

joymn

(12.02.2022)

nerb

(01.12.2021)

ivanenokEr

(12.11.2021)

ChapligaCewly

(11.11.2021)

burenoksoita

(24.10.2021)

KarasevEr

(15.07.2021)

TRON

(28.05.2021)

anemy

(09.05.2021)


Карта форума
Rambler's Top100