Форум Flasher.ru

Форум Flasher.ru (http://www.flasher.ru/forum/index.php)
-   ActionScript 1.0/2.0 (http://www.flasher.ru/forum/forumdisplay.php?f=93)
-   -   else if (http://www.flasher.ru/forum/showthread.php?t=70396)

sanelo 13.10.2005 19:47

else if
 
подскажите почему не обрабатывается третье условие else if и может гдето ошибка
Код:

currentTime = new Date();
launchedDate = new Date (2005, 10, 25);
days = (launchedDate - currentTime) / 1000 / 60 / 60 / 24;
daysRound = Math.floor(days)-30;
ft=Math.floor(daysRound/100);
if (daysRound > 100) {
        st=Math.floor(Math.abs ((daysRound-100)/10));
}
else {
        st=Math.floor(daysRound/10);
}
tt=daysRound-ft*100-st*10;
if((tt==1 and daysRound<11) or (tt==1 and (20<daysRound<111)) or (tt==1 and daysRound>120)){
        tex = "день";
}
else if(((2<=tt<=4) and daysRound<11) or ((2<=tt<=4) and (20<daysRound<111)) or ((2<=tt<=4) and daysRound>120)){
        tex = "дня";
}
else if((5<=tt<=9) or tt==0 or (11<=daysRound<=20) or (111<=daysRound<=120)){       
        tex = "днів";
}

спасибо

7thsky™ 13.10.2005 21:58

Код:

t = 7;
trace ('>> ' + (1 < t < 5));

фактически равно
Код:

trace ('>> ' + (Number ((1 < t)) < 5));

iNils 13.10.2005 22:37

Если ты хочешь делать вывод надписей в зависимости от дней, то есть схема проще. По крайне мере для русского.

Код:

for (i = 1; i < 320; i++) {
        tx = String (i).substr (-1, 1);
        txx = String (i).substr (-2, 2);
        if ((txx == 11) or (txx == 12) or (txx == 13) or (txx == 14)) {
                suffix = "дней";
        } else if (tx == 1) {
                suffix = "день";
        } else if ((tx == 2) or (tx == 3) or (tx == 4)) {
                suffix = "дня";
        } else {
                suffix = "дней";
        }
        trace (i + " " + suffix);
}


sanelo 14.10.2005 12:21

iNils спасибо помогло :)


Часовой пояс GMT +4, время: 00:40.

Copyright © 1999-2008 Flasher.ru. All rights reserved.
Работает на vBulletin®. Copyright ©2000 - 2026, Jelsoft Enterprises Ltd. Перевод: zCarot
Администрация сайта не несёт ответственности за любую предоставленную посетителями информацию. Подробнее см. Правила.