• JAVASCRIPT (60 баллов)
    Объединить эти функции в одну
    function setPrev()
    {
    var month = document.Control.month.selectedIndex - 1;
    document.Control.month.selectedIndex = month;
    var year = document.Control.year.selectedIndex + 1900;
    formCalendar(month, year);
    }

    function setNext()
    {
    var month = document.Control.month.selectedIndex + 1;
    document.Control.month.selectedIndex = month;
    var year = document.Control.year.selectedIndex + 1900;
    formCalendar(month, year);
    }

    function selectDate()
    {
    var year = document.Control.year.selectedIndex + 1900;
    var month = document.Control.month.selectedIndex;
    formCalendar(month, year);
    }

    (это КАЛЕНДАРЬ!)

Ответы 1

  • <HTML> <HEAD> <meta charset="utf-8"> <TITLE>Календарь</TITLE> <STYLE TYPE="text/css">  .blue    {       color: rgb(0, 0, 255);       border: rgb(0, 0, 255) 2px  solid;    } </STYLE>   <SCRIPT language="JavaScript">     function setToday()   {   var now   = new Date();   var month = now.getMonth();   var year1  = now.getYear();   var day  = now.getDay();   var year  = now.getYear() + 1900;   var day  = now.getDate();   document.Control.month.selectedIndex = month;   document.Control.year.selectedIndex = year1 ;   formCalendar(month, year, day);     }   function setPrev()   {   var month = document.Control.month.selectedIndex - 1;   document.Control.month.selectedIndex = month;   var year = document.Control.year.selectedIndex + 1900;   formCalendar(month, year);   }   function setNext()   {   var month = document.Control.month.selectedIndex + 1;   document.Control.month.selectedIndex = month;   var year = document.Control.year.selectedIndex + 1900;   formCalendar(month, year);   }   function selectDate()   {   var year  = document.Control.year.selectedIndex + 1900;   var month = document.Control.month.selectedIndex;   formCalendar(month, year);   }   function getDaysInMonth(_month,_year)   {   var days;   var daysInMonth = new Array(31,28,31,30,31,30,31,31,30,31,30,31);   days = daysInMonth[_month];   if (_month==2 && isLeapYear(_year)) days = 29;   return days;   }   function isLeapYear (Year)   {   if (((Year % 4)==0) && ((Year % 100)!=0) || ((Year % 400)==0))     return true;   else return false;   }   function formCalendar(month, year, now)   {   month = parseInt(month);   year = parseInt(year);   D = new Date(year,month,0);   var temp;   temp = "<TABLE ID='calTab' cellspacing=0 cellpadding=0 border=0 style='font-family: serif;'>";   temp += "<TBODY ID='calBody' align='center'>";   temp += "<TR><TD width=25 height=25>Пн<TD width=25>Вт<TD width=25>Ср<TD width=25>";   temp += "Чт<TD width=25>Пт<TD width=25>Сб<TD width=25>Вс</TR><TR>";   var n = D.getDay();   for (i=0; i<n; i++)     {     temp += "<TD>&nbsp</TD>"; }   var num = getDaysInMonth(month,year);   for (i=1; i<=num; i++)     {     var cls = i == now ? 'blue' : ''       if ((i+n)%7 || !i) temp += "<TD height=20 class ='"+cls+"'>" + i + "</TD>";        else temp += "<TD class ='"+cls+"'>" + i + "</TD></TR><TR>"; }   D = new Date(year,month,num-1);   num = D.getDay();     for (i=num; i<6; i++)     {     temp += "<TD>&nbsp</TD>"; }   temp += "</TR></TBODY></TABLE>";   document.all["calTab"].outerHTML = temp;   } </SCRIPT>

  • Добавить свой ответ

Еще вопросы

Войти через Google

или

Забыли пароль?

У меня нет аккаунта, я хочу Зарегистрироваться

How much to ban the user?
1 hour 1 day 100 years